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
5df17acb
Unverified
Commit
5df17acb
authored
Aug 02, 2019
by
chunhtai
Committed by
GitHub
Aug 02, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add ontap to textformfield (#37403)
parent
873de562
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
0 deletions
+29
-0
text_form_field.dart
packages/flutter/lib/src/material/text_form_field.dart
+2
-0
text_form_field_test.dart
packages/flutter/test/material/text_form_field_test.dart
+27
-0
No files found.
packages/flutter/lib/src/material/text_form_field.dart
View file @
5df17acb
...
...
@@ -100,6 +100,7 @@ class TextFormField extends FormField<String> {
bool
expands
=
false
,
int
maxLength
,
ValueChanged
<
String
>
onChanged
,
GestureTapCallback
onTap
,
VoidCallback
onEditingComplete
,
ValueChanged
<
String
>
onFieldSubmitted
,
FormFieldSetter
<
String
>
onSaved
,
...
...
@@ -175,6 +176,7 @@ class TextFormField extends FormField<String> {
expands:
expands
,
maxLength:
maxLength
,
onChanged:
onChangedHandler
,
onTap:
onTap
,
onEditingComplete:
onEditingComplete
,
onSubmitted:
onFieldSubmitted
,
inputFormatters:
inputFormatters
,
...
...
packages/flutter/test/material/text_form_field_test.dart
View file @
5df17acb
...
...
@@ -280,4 +280,31 @@ void main() {
await
tester
.
pump
(
const
Duration
(
milliseconds:
200
));
expect
(
renderEditable
,
paintsExactlyCountTimes
(
#drawRect
,
0
));
});
testWidgets
(
'onTap is called upon tap'
,
(
WidgetTester
tester
)
async
{
int
tapCount
=
0
;
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Material
(
child:
Center
(
child:
TextFormField
(
onTap:
()
{
tapCount
+=
1
;
},
),
),
),
),
);
expect
(
tapCount
,
0
);
await
tester
.
tap
(
find
.
byType
(
TextField
));
// Wait a bit so they're all single taps and not double taps.
await
tester
.
pump
(
const
Duration
(
milliseconds:
300
));
await
tester
.
tap
(
find
.
byType
(
TextField
));
await
tester
.
pump
(
const
Duration
(
milliseconds:
300
));
await
tester
.
tap
(
find
.
byType
(
TextField
));
await
tester
.
pump
(
const
Duration
(
milliseconds:
300
));
expect
(
tapCount
,
3
);
});
}
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