Add fixes for autovalidate deprecation in Form, FormField, TextFormField, and DropdownButtonFormField (#73996)

This commit is contained in:
Kate Lovett
2021-01-15 19:04:03 -06:00
committed by GitHub
parent 54ef030ab8
commit 45d01c95de
10 changed files with 244 additions and 6 deletions

View File

@@ -11,6 +11,168 @@
version: 1
transforms:
# Changes made in https://github.com/flutter/flutter/pull/61648
- title: 'Migrate to autovalidateMode'
date: 2020-09-02
element:
uris: [ 'widgets.dart', 'material.dart', 'cupertino.dart' ]
field: 'autovalidate'
inClass: 'Form'
changes:
- kind: 'rename'
newName: 'autovalidateMode'
# Changes made in https://github.com/flutter/flutter/pull/61648
- title: 'Migrate to autovalidateMode'
date: 2020-09-02
element:
uris: [ 'widgets.dart', 'material.dart', 'cupertino.dart' ]
constructor: ''
inClass: 'Form'
oneOf:
- if: "autovalidate == 'true'"
changes:
- kind: 'addParameter'
index: 0
name: 'autovalidateMode'
style: optional_named
argumentValue:
expression: 'AutoValidateMode.always'
requiredIf: "autovalidate == 'true'"
- kind: 'removeParameter'
name: 'autovalidate'
- if: "autovalidate == 'false'"
changes:
- kind: 'addParameter'
index: 0
name: 'autovalidateMode'
style: optional_named
argumentValue:
expression: 'AutoValidateMode.disabled'
requiredIf: "autovalidate == 'false'"
- kind: 'removeParameter'
name: 'autovalidate'
variables:
autovalidate:
kind: 'fragment'
value: 'arguments[autovalidate]'
# Changes made in https://github.com/flutter/flutter/pull/61648
- title: 'Migrate to autovalidateMode'
date: 2020-09-02
element:
uris: [ 'widgets.dart', 'material.dart', 'cupertino.dart' ]
field: 'autovalidate'
inClass: 'FormField'
changes:
- kind: 'rename'
newName: 'autovalidateMode'
# Changes made in https://github.com/flutter/flutter/pull/61648
- title: 'Migrate to autovalidateMode'
date: 2020-09-02
element:
uris: [ 'widgets.dart', 'material.dart', 'cupertino.dart' ]
constructor: ''
inClass: 'FormField'
oneOf:
- if: "autovalidate == 'true'"
changes:
- kind: 'addParameter'
index: 0
name: 'autovalidateMode'
style: optional_named
argumentValue:
expression: 'AutoValidateMode.always'
requiredIf: "autovalidate == 'true'"
- kind: 'removeParameter'
name: 'autovalidate'
- if: "autovalidate == 'false'"
changes:
- kind: 'addParameter'
index: 0
name: 'autovalidateMode'
style: optional_named
argumentValue:
expression: 'AutoValidateMode.disabled'
requiredIf: "autovalidate == 'false'"
- kind: 'removeParameter'
name: 'autovalidate'
variables:
autovalidate:
kind: 'fragment'
value: 'arguments[autovalidate]'
# Changes made in https://github.com/flutter/flutter/pull/61648
- title: 'Migrate to autovalidateMode'
date: 2020-09-02
element:
uris: [ 'material.dart' ]
constructor: ''
inClass: 'TextFormField'
oneOf:
- if: "autovalidate == 'true'"
changes:
- kind: 'addParameter'
index: 0
name: 'autovalidateMode'
style: optional_named
argumentValue:
expression: 'AutoValidateMode.always'
requiredIf: "autovalidate == 'true'"
- kind: 'removeParameter'
name: 'autovalidate'
- if: "autovalidate == 'false'"
changes:
- kind: 'addParameter'
index: 0
name: 'autovalidateMode'
style: optional_named
argumentValue:
expression: 'AutoValidateMode.disabled'
requiredIf: "autovalidate == 'false'"
- kind: 'removeParameter'
name: 'autovalidate'
variables:
autovalidate:
kind: 'fragment'
value: 'arguments[autovalidate]'
# Changes made in https://github.com/flutter/flutter/pull/61648
- title: 'Migrate to autovalidateMode'
date: 2020-09-02
element:
uris: [ 'material.dart' ]
constructor: ''
inClass: 'DropdownButtonFormField'
oneOf:
- if: "autovalidate == 'true'"
changes:
- kind: 'addParameter'
index: 0
name: 'autovalidateMode'
style: optional_named
argumentValue:
expression: 'AutoValidateMode.always'
requiredIf: "autovalidate == 'true'"
- kind: 'removeParameter'
name: 'autovalidate'
- if: "autovalidate == 'false'"
changes:
- kind: 'addParameter'
index: 0
name: 'autovalidateMode'
style: optional_named
argumentValue:
expression: 'AutoValidateMode.disabled'
requiredIf: "autovalidate == 'false'"
- kind: 'removeParameter'
name: 'autovalidate'
variables:
autovalidate:
kind: 'fragment'
value: 'arguments[autovalidate]'
# Changes made in https://github.com/flutter/flutter/pull/48547
- title: 'Renamed to headline1'
date: 2020-01-24

View File

@@ -1471,7 +1471,7 @@ class DropdownButtonFormField<T> extends FormField<T> {
FormFieldSetter<T>? onSaved,
FormFieldValidator<T>? validator,
@Deprecated(
'Use autoValidateMode parameter which provide more specific '
'Use autovalidateMode parameter which provide more specific '
'behaviour related to auto validation. '
'This feature was deprecated after v1.19.0.'
)

View File

@@ -157,7 +157,7 @@ class TextFormField extends FormField<String> {
SmartQuotesType? smartQuotesType,
bool enableSuggestions = true,
@Deprecated(
'Use autoValidateMode parameter which provide more specific '
'Use autovalidateMode parameter which provide more specific '
'behaviour related to auto validation. '
'This feature was deprecated after v1.19.0.'
)

View File

@@ -77,7 +77,7 @@ class Form extends StatefulWidget {
Key? key,
required this.child,
@Deprecated(
'Use autoValidateMode parameter which provides more specific '
'Use autovalidateMode parameter which provides more specific '
'behavior related to auto validation. '
'This feature was deprecated after v1.19.0.'
)
@@ -143,7 +143,7 @@ class Form extends StatefulWidget {
/// Used to enable/disable form fields auto validation and update their error
/// text.
@Deprecated(
'Use autoValidateMode parameter which provides more specific '
'Use autovalidateMode parameter which provides more specific '
'behavior related to auto validation. '
'This feature was deprecated after v1.19.0.'
)
@@ -326,7 +326,7 @@ class FormField<T> extends StatefulWidget {
this.validator,
this.initialValue,
@Deprecated(
'Use autoValidateMode parameter which provides more specific '
'Use autovalidateMode parameter which provides more specific '
'behavior related to auto validation. '
'This feature was deprecated after v1.19.0.'
)
@@ -395,7 +395,7 @@ class FormField<T> extends StatefulWidget {
/// Used to enable/disable auto validation and update their error
/// text.
@Deprecated(
'Use autoValidateMode parameter which provides more specific '
'Use autovalidateMode parameter which provides more specific '
'behavior related to auto validation. '
'This feature was deprecated after v1.19.0.'
)

View File

@@ -27,4 +27,14 @@ void main() {
buildContext.ancestorStateOfType(TypeMatcher<targetType>());
buildContext.rootAncestorStateOfType(TypeMatcher<targetType>());
buildContext.ancestorRenderObjectOfType(TypeMatcher<targetType>());
// Changes made in https://github.com/flutter/flutter/pull/61648
const Form form = Form(autovalidate: true);
const Form form = Form(autovalidate: false);
final autoMode = form.autovalidate;
// Changes made in https://github.com/flutter/flutter/pull/61648
const FormField formField = FormField(autovalidate: true);
const FormField formField = FormField(autovalidate: false);
final autoMode = formField.autovalidate;
}

View File

@@ -27,4 +27,14 @@ void main() {
buildContext.findAncestorStateOfType<targetType>();
buildContext.findRootAncestorStateOfType<targetType>();
buildContext.findAncestorRenderObjectOfType<targetType>();
// Changes made in https://github.com/flutter/flutter/pull/61648
const Form form = Form(autovalidateMode: AutoValidateMode.always);
const Form form = Form(autovalidateMode: AutoValidateMode.disabled);
final autoMode = form.autovalidateMode;
// Changes made in https://github.com/flutter/flutter/pull/61648
const FormField formField = FormField(autovalidateMode: AutoValidateMode.always);
const FormField formField = FormField(autovalidateMode: AutoValidateMode.disabled);
final autoMode = formField.autovalidateMode;
}

View File

@@ -27,6 +27,24 @@ void main() {
buildContext.rootAncestorStateOfType(TypeMatcher<targetType>());
buildContext.ancestorRenderObjectOfType(TypeMatcher<targetType>());
// Changes made in https://github.com/flutter/flutter/pull/61648
const Form form = Form(autovalidate: true);
const Form form = Form(autovalidate: false);
final autoMode = form.autovalidate;
// Changes made in https://github.com/flutter/flutter/pull/61648
const FormField formField = FormField(autovalidate: true);
const FormField formField = FormField(autovalidate: false);
final autoMode = formField.autovalidate;
// Changes made in https://github.com/flutter/flutter/pull/61648
const TextFormField textFormField = TextFormField(autovalidate: true);
const TextFormField textFormField = TextFormField(autovalidate: false);
// Changes made in https://github.com/flutter/flutter/pull/61648
const DropdownButtonFormField dropDownButtonFormField = DropdownButtonFormField(autovalidate: true);
const DropdownButtonFormField dropdownButtonFormField = DropdownButtonFormField(autovalidate: false);
// Changes made in https://github.com/flutter/flutter/pull/48547
var TextTheme textTheme = TextTheme(
display4: displayStyle4,

View File

@@ -27,6 +27,24 @@ void main() {
buildContext.findRootAncestorStateOfType<targetType>();
buildContext.findAncestorRenderObjectOfType<targetType>();
// Changes made in https://github.com/flutter/flutter/pull/61648
const Form form = Form(autovalidateMode: AutoValidateMode.always);
const Form form = Form(autovalidateMode: AutoValidateMode.disabled);
final autoMode = form.autovalidateMode;
// Changes made in https://github.com/flutter/flutter/pull/61648
const FormField formField = FormField(autovalidateMode: AutoValidateMode.always);
const FormField formField = FormField(autovalidateMode: AutoValidateMode.disabled);
final autoMode = formField.autovalidateMode;
// Changes made in https://github.com/flutter/flutter/pull/61648
const TextFormField textFormField = TextFormField(autovalidateMode: AutoValidateMode.always);
const TextFormField textFormField = TextFormField(autovalidateMode: AutoValidateMode.disabled);
// Changes made in https://github.com/flutter/flutter/pull/61648
const DropdownButtonFormField dropDownButtonFormField = DropdownButtonFormField(autovalidateMode: AutoValidateMode.always);
const DropdownButtonFormField dropdownButtonFormField = DropdownButtonFormField(autovalidateMode: AutoValidateMode.disabled);
// Changes made in https://github.com/flutter/flutter/pull/48547
var TextTheme textTheme = TextTheme(
headline1: displayStyle4,

View File

@@ -24,6 +24,16 @@ void main() {
buildContext.rootAncestorStateOfType(TypeMatcher<targetType>());
buildContext.ancestorRenderObjectOfType(TypeMatcher<targetType>());
// Changes made in https://github.com/flutter/flutter/pull/61648
const Form form = Form(autovalidate: true);
const Form form = Form(autovalidate: false);
final autoMode = form.autovalidate;
// Changes made in https://github.com/flutter/flutter/pull/61648
const FormField formField = FormField(autovalidate: true);
const FormField formField = FormField(autovalidate: false);
final autoMode = formField.autovalidate;
// Changes made in https://github.com/flutter/flutter/pull/66305
const Stack stack = Stack(overflow: Overflow.visible);
const Stack stack = Stack(overflow: Overflow.clip);

View File

@@ -24,6 +24,16 @@ void main() {
buildContext.findRootAncestorStateOfType<targetType>();
buildContext.findAncestorRenderObjectOfType<targetType>();
// Changes made in https://github.com/flutter/flutter/pull/61648
const Form form = Form(autovalidateMode: AutoValidateMode.always);
const Form form = Form(autovalidateMode: AutoValidateMode.disabled);
final autoMode = form.autovalidateMode;
// Changes made in https://github.com/flutter/flutter/pull/61648
const FormField formField = FormField(autovalidateMode: AutoValidateMode.always);
const FormField formField = FormField(autovalidateMode: AutoValidateMode.disabled);
final autoMode = formField.autovalidateMode;
// Changes made in https://github.com/flutter/flutter/pull/66305
const Stack stack = Stack(clipBehavior: Clip.none);
const Stack stack = Stack(clipBehavior: Clip.hardEdge);