Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
5de09188
Unverified
Commit
5de09188
authored
Oct 06, 2022
by
Hardeep Singh
Committed by
GitHub
Oct 06, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: Add keyboardType in CupertinoSearchTextField (#83994)
parent
ad2005c4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
0 deletions
+23
-0
search_field.dart
packages/flutter/lib/src/cupertino/search_field.dart
+7
-0
search_field_test.dart
packages/flutter/test/cupertino/search_field_test.dart
+16
-0
No files found.
packages/flutter/lib/src/cupertino/search_field.dart
View file @
5de09188
...
...
@@ -108,6 +108,7 @@ class CupertinoSearchTextField extends StatefulWidget {
this
.
decoration
,
this
.
backgroundColor
,
this
.
borderRadius
,
this
.
keyboardType
=
TextInputType
.
text
,
this
.
padding
=
const
EdgeInsetsDirectional
.
fromSTEB
(
3.8
,
8
,
5
,
8
),
this
.
itemColor
=
CupertinoColors
.
secondaryLabel
,
this
.
itemSize
=
20.0
,
...
...
@@ -195,6 +196,11 @@ class CupertinoSearchTextField extends StatefulWidget {
// https://github.com/flutter/flutter/issues/13914.
final
BorderRadius
?
borderRadius
;
/// The keyboard type for this search field.
///
/// Defaults to TextInputType.text.
final
TextInputType
?
keyboardType
;
/// Sets the padding insets for the text and placeholder.
///
/// Cannot be null. Defaults to padding that replicates the
...
...
@@ -440,6 +446,7 @@ class _CupertinoSearchTextFieldState extends State<CupertinoSearchTextField>
style:
widget
.
style
,
prefix:
prefix
,
suffix:
suffix
,
keyboardType:
widget
.
keyboardType
,
onTap:
widget
.
onTap
,
enabled:
widget
.
enabled
,
suffixMode:
widget
.
suffixMode
,
...
...
packages/flutter/test/cupertino/search_field_test.dart
View file @
5de09188
...
...
@@ -112,6 +112,22 @@ void main() {
},
);
testWidgets
(
'can change keyboard type'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
const
CupertinoApp
(
home:
Center
(
child:
CupertinoSearchTextField
(
keyboardType:
TextInputType
.
number
,
),
),
),
);
await
tester
.
tap
(
find
.
byType
(
CupertinoSearchTextField
));
await
tester
.
showKeyboard
(
find
.
byType
(
CupertinoSearchTextField
));
expect
((
tester
.
testTextInput
.
setClientArgs
![
'inputType'
]
as
Map
<
String
,
dynamic
>)[
'name'
],
equals
(
'TextInputType.number'
));
},
);
testWidgets
(
'can control text content via controller'
,
(
WidgetTester
tester
)
async
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment