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
f134f039
Unverified
Commit
f134f039
authored
Aug 04, 2021
by
Viren Khatri
Committed by
GitHub
Aug 04, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added autofocus and test (#87591)
parent
d841dd40
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
0 deletions
+21
-0
search_field.dart
packages/flutter/lib/src/cupertino/search_field.dart
+5
-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 @
f134f039
...
...
@@ -151,6 +151,7 @@ class CupertinoSearchTextField extends StatefulWidget {
this
.
onSuffixTap
,
this
.
restorationId
,
this
.
focusNode
,
this
.
autofocus
=
false
,
this
.
onTap
,
this
.
autocorrect
=
true
,
this
.
enabled
,
...
...
@@ -287,6 +288,9 @@ class CupertinoSearchTextField extends StatefulWidget {
/// {@macro flutter.widgets.Focus.focusNode}
final
FocusNode
?
focusNode
;
/// {@macro flutter.widgets.editableText.autofocus}
final
bool
autofocus
;
/// {@macro flutter.material.textfield.onTap}
final
VoidCallback
?
onTap
;
...
...
@@ -429,6 +433,7 @@ class _CupertinoSearchTextFieldState extends State<CupertinoSearchTextField>
onChanged:
widget
.
onChanged
,
onSubmitted:
widget
.
onSubmitted
,
focusNode:
widget
.
focusNode
,
autofocus:
widget
.
autofocus
,
autocorrect:
widget
.
autocorrect
,
textInputAction:
TextInputAction
.
search
,
);
...
...
packages/flutter/test/cupertino/search_field_test.dart
View file @
f134f039
...
...
@@ -562,4 +562,20 @@ void main() {
final
CupertinoTextField
textField
=
tester
.
widget
(
find
.
byType
(
CupertinoTextField
));
expect
(
textField
.
textInputAction
,
TextInputAction
.
search
);
});
testWidgets
(
'autofocus:true gives focus to the widget'
,
(
WidgetTester
tester
)
async
{
final
FocusNode
focusNode
=
FocusNode
();
await
tester
.
pumpWidget
(
CupertinoApp
(
home:
Center
(
child:
CupertinoSearchTextField
(
focusNode:
focusNode
,
autofocus:
true
,
),
),
),
);
expect
(
focusNode
.
hasFocus
,
isTrue
);
});
}
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