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
49900477
Unverified
Commit
49900477
authored
Apr 10, 2019
by
Todd Volkert
Committed by
GitHub
Apr 10, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Add Form.onSaved (#30643)" (#30793)
This reverts commit
949023b2
.
parent
f34c2ef0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
18 deletions
+2
-18
form.dart
packages/flutter/lib/src/widgets/form.dart
+0
-10
form_test.dart
packages/flutter/test/widgets/form_test.dart
+2
-8
No files found.
packages/flutter/lib/src/widgets/form.dart
View file @
49900477
...
...
@@ -72,7 +72,6 @@ class Form extends StatefulWidget {
this
.
autovalidate
=
false
,
this
.
onWillPop
,
this
.
onChanged
,
this
.
onSaved
,
})
:
assert
(
child
!=
null
),
super
(
key:
key
);
...
...
@@ -119,13 +118,6 @@ class Form extends StatefulWidget {
/// will rebuild.
final
VoidCallback
onChanged
;
/// Called when the form is saved (after all the form fields have been saved).
///
/// See also:
///
/// * [FormState.save]
final
VoidCallback
onSaved
;
@override
FormState
createState
()
=>
FormState
();
}
...
...
@@ -180,8 +172,6 @@ class FormState extends State<Form> {
void
save
()
{
for
(
FormFieldState
<
dynamic
>
field
in
_fields
)
field
.
save
();
if
(
widget
.
onSaved
!=
null
)
widget
.
onSaved
();
}
/// Resets every [FormField] that is a descendant of this [Form] back to its
...
...
packages/flutter/test/widgets/form_test.dart
View file @
49900477
...
...
@@ -6,10 +6,9 @@ import 'package:flutter_test/flutter_test.dart';
import
'package:flutter/material.dart'
;
void
main
(
)
{
testWidgets
(
'onSaved callback
s are
called'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'onSaved callback
is
called'
,
(
WidgetTester
tester
)
async
{
final
GlobalKey
<
FormState
>
formKey
=
GlobalKey
<
FormState
>();
String
fieldValue
;
bool
fieldModifiedSinceFormOnSaved
;
Widget
builder
()
{
return
MediaQuery
(
...
...
@@ -20,12 +19,8 @@ void main() {
child:
Material
(
child:
Form
(
key:
formKey
,
onSaved:
()
{
fieldModifiedSinceFormOnSaved
=
false
;
},
child:
TextFormField
(
onSaved:
(
String
value
)
{
fieldValue
=
value
;
fieldModifiedSinceFormOnSaved
=
true
;
},
onSaved:
(
String
value
)
{
fieldValue
=
value
;
},
),
),
),
...
...
@@ -43,7 +38,6 @@ void main() {
formKey
.
currentState
.
save
();
// pump'ing is unnecessary because callback happens regardless of frames
expect
(
fieldValue
,
equals
(
testValue
));
expect
(
fieldModifiedSinceFormOnSaved
,
isFalse
);
}
await
checkText
(
'Test'
);
...
...
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