@@ -59,7 +59,7 @@ class FormBuilder extends StatefulWidget {
59
59
final bool enabled;
60
60
61
61
/// Whether the form should auto focus on the first field that fails validation.
62
- final bool validationAutoFocus ;
62
+ final bool autoFocusOnValidationFailure ;
63
63
64
64
/// Creates a container for form fields.
65
65
///
@@ -73,7 +73,7 @@ class FormBuilder extends StatefulWidget {
73
73
this .initialValue = const < String , dynamic > {},
74
74
this .skipDisabled = false ,
75
75
this .enabled = true ,
76
- this .validationAutoFocus = true ,
76
+ this .autoFocusOnValidationFailure = false ,
77
77
}) : super (key: key);
78
78
79
79
static FormBuilderState ? of (BuildContext context) =>
@@ -115,7 +115,7 @@ class FormBuilderState extends State<FormBuilder> {
115
115
// assistance to accidental duplicate names, we check and emit a warning.
116
116
assert (() {
117
117
if (_fields.containsKey (name)) {
118
- print ('Warning! Replacing duplicate Field for $name '
118
+ debugPrint ('Warning! Replacing duplicate Field for $name '
119
119
' -- this is OK to ignore as long as the field was intentionally replaced' );
120
120
}
121
121
return true ;
@@ -135,7 +135,7 @@ class FormBuilderState extends State<FormBuilder> {
135
135
assert (() {
136
136
// This is OK to ignore when you are intentionally replacing a field
137
137
// with another field using the same name.
138
- print ('Warning! Ignoring Field unregistration for $name '
138
+ debugPrint ('Warning! Ignoring Field unregistration for $name '
139
139
' -- this is OK to ignore as long as the field was intentionally replaced' );
140
140
return true ;
141
141
}());
@@ -156,7 +156,7 @@ class FormBuilderState extends State<FormBuilder> {
156
156
157
157
bool validate () {
158
158
final hasError = ! _formKey.currentState! .validate ();
159
- if (hasError && widget.validationAutoFocus ) {
159
+ if (hasError && widget.autoFocusOnValidationFailure ) {
160
160
final wrongFields =
161
161
fields.values.where ((element) => element.hasError).toList ();
162
162
wrongFields.first.requestFocus ();
0 commit comments