Skip to content

Commit

Permalink
fix:Rename Form.autovalidateMode, to Form.autoValidateMode flutter#11…
Browse files Browse the repository at this point in the history
  • Loading branch information
maheshj01 committed Dec 14, 2024
1 parent 0875988 commit c140084
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ class CupertinoTextFormFieldRow extends FormField<String> {
TextSelectionControls? selectionControls,
ScrollPhysics? scrollPhysics,
Iterable<String>? autofillHints,
AutovalidateMode super.autovalidateMode = AutovalidateMode.disabled,
AutovalidateMode super.autoValidateMode = AutovalidateMode.disabled,
String? placeholder,
TextStyle? placeholderStyle = const TextStyle(
fontWeight: FontWeight.w400,
Expand Down
2 changes: 1 addition & 1 deletion packages/flutter/lib/src/material/dropdown.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1734,7 +1734,7 @@ class DropdownButtonFormField<T> extends FormField<T> {
decoration = decoration ?? const InputDecoration(),
super(
initialValue: value,
autovalidateMode: autovalidateMode ?? AutovalidateMode.disabled,
autoValidateMode: autovalidateMode ?? AutovalidateMode.disabled,
builder: (FormFieldState<T> field) {
final _DropdownButtonFormFieldState<T> state = field as _DropdownButtonFormFieldState<T>;
final InputDecoration decorationArg = decoration ?? const InputDecoration();
Expand Down
2 changes: 1 addition & 1 deletion packages/flutter/lib/src/material/text_form_field.dart
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ class TextFormField extends FormField<String> {
super(
initialValue: controller != null ? controller.text : (initialValue ?? ''),
enabled: enabled ?? decoration?.enabled ?? true,
autovalidateMode: autovalidateMode ?? AutovalidateMode.disabled,
autoValidateMode: autovalidateMode ?? AutovalidateMode.disabled,
builder: (FormFieldState<String> field) {
final _TextFormFieldState state = field as _TextFormFieldState;
final InputDecoration effectiveDecoration = (decoration ?? const InputDecoration())
Expand Down
12 changes: 6 additions & 6 deletions packages/flutter/lib/src/widgets/form.dart
Original file line number Diff line number Diff line change
Expand Up @@ -455,9 +455,9 @@ class FormField<T> extends StatefulWidget {
this.validator,
this.initialValue,
this.enabled = true,
AutovalidateMode? autovalidateMode,
AutovalidateMode? autoValidateMode,
this.restorationId,
}) : autovalidateMode = autovalidateMode ?? AutovalidateMode.disabled;
}) : autoValidateMode = autoValidateMode ?? AutovalidateMode.disabled;

/// An optional method to call with the final value when the form is saved via
/// [FormState.save].
Expand Down Expand Up @@ -530,7 +530,7 @@ class FormField<T> extends StatefulWidget {
///
/// Defaults to [AutovalidateMode.disabled].
/// {@endtemplate}
final AutovalidateMode autovalidateMode;
final AutovalidateMode autoValidateMode;

/// Restoration ID to save and restore the state of the form field.
///
Expand Down Expand Up @@ -728,7 +728,7 @@ class FormFieldState<T> extends State<FormField<T>> with RestorationMixin {
@override
Widget build(BuildContext context) {
if (widget.enabled) {
switch (widget.autovalidateMode) {
switch (widget.autoValidateMode) {
case AutovalidateMode.always:
_validate();
case AutovalidateMode.onUserInteraction:
Expand All @@ -743,8 +743,8 @@ class FormFieldState<T> extends State<FormField<T>> with RestorationMixin {

Form.maybeOf(context)?._register(this);

if (Form.maybeOf(context)?.widget.autovalidateMode == AutovalidateMode.onUnfocus && widget.autovalidateMode != AutovalidateMode.always ||
widget.autovalidateMode == AutovalidateMode.onUnfocus) {
if (Form.maybeOf(context)?.widget.autovalidateMode == AutovalidateMode.onUnfocus && widget.autoValidateMode != AutovalidateMode.always ||
widget.autoValidateMode == AutovalidateMode.onUnfocus) {
return Focus(
canRequestFocus: false,
skipTraversal: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void main() {
return Material(
child: CupertinoTextFormFieldRow(
key: formState,
autovalidateMode: AutovalidateMode.onUserInteraction,
autoValidateMode: AutovalidateMode.onUserInteraction,
restorationId: 'text_form_field',
initialValue: 'foo',
validator: errorText,
Expand Down Expand Up @@ -111,7 +111,7 @@ void main() {
child: CupertinoTextFormFieldRow(
key: formState,
restorationId: 'form_field',
autovalidateMode: mode,
autoValidateMode: mode,
initialValue: 'foo',
validator: errorText,
),
Expand Down
10 changes: 5 additions & 5 deletions packages/flutter/test/cupertino/text_form_field_row_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ void main() {
CupertinoApp(
home: Center(
child: CupertinoTextFormFieldRow(
autovalidateMode: AutovalidateMode.always,
autoValidateMode: AutovalidateMode.always,
validator: (String? value) {
validateCalled++;
return null;
Expand All @@ -229,7 +229,7 @@ void main() {
home: Center(
child: CupertinoTextFormFieldRow(
enabled: true,
autovalidateMode: AutovalidateMode.always,
autoValidateMode: AutovalidateMode.always,
validator: (String? value) {
validateCalled += 1;
return null;
Expand Down Expand Up @@ -399,7 +399,7 @@ void main() {
CupertinoApp(
home: CupertinoPageScaffold(
child: CupertinoTextFormFieldRow(
autovalidateMode: AutovalidateMode.onUserInteraction,
autoValidateMode: AutovalidateMode.onUserInteraction,
validator: (String? value) {
validateCalled++;
return null;
Expand All @@ -421,7 +421,7 @@ void main() {
home: Center(
child: CupertinoTextFormFieldRow(
initialValue: 'Value',
autovalidateMode: AutovalidateMode.always,
autoValidateMode: AutovalidateMode.always,
validator: (String? value) => 'Error',
),
),
Expand All @@ -443,7 +443,7 @@ void main() {
home: Center(
child: CupertinoTextFormFieldRow(
controller: controller,
autovalidateMode: AutovalidateMode.onUserInteraction,
autoValidateMode: AutovalidateMode.onUserInteraction,
validator: (String? value) => 'Error',
),
),
Expand Down
4 changes: 2 additions & 2 deletions packages/flutter/test/widgets/form_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,7 @@ void main() {
child: Material(
child: FormField<String>(
initialValue: 'foo',
autovalidateMode: AutovalidateMode.onUserInteraction,
autoValidateMode: AutovalidateMode.onUserInteraction,
builder: (FormFieldState<String> state) {
formFieldState = state;
return Container();
Expand Down Expand Up @@ -798,7 +798,7 @@ void main() {
child: Material(
child: FormField<String>(
initialValue: 'foo',
autovalidateMode: AutovalidateMode.always,
autoValidateMode: AutovalidateMode.always,
builder: (FormFieldState<String> state) {
formFieldState = state;
return Container();
Expand Down

0 comments on commit c140084

Please sign in to comment.