Unverified Commit 07f9563d authored by Pedro Massango's avatar Pedro Massango Committed by GitHub

Add autofill support for TextFormField (#57332)

parent e8a7dc46
...@@ -174,6 +174,7 @@ class TextFormField extends FormField<String> { ...@@ -174,6 +174,7 @@ class TextFormField extends FormField<String> {
bool enableInteractiveSelection = true, bool enableInteractiveSelection = true,
InputCounterWidgetBuilder buildCounter, InputCounterWidgetBuilder buildCounter,
ScrollPhysics scrollPhysics, ScrollPhysics scrollPhysics,
Iterable<String> autofillHints,
}) : assert(initialValue == null || controller == null), }) : assert(initialValue == null || controller == null),
assert(textAlign != null), assert(textAlign != null),
assert(autofocus != null), assert(autofocus != null),
...@@ -257,6 +258,7 @@ class TextFormField extends FormField<String> { ...@@ -257,6 +258,7 @@ class TextFormField extends FormField<String> {
keyboardAppearance: keyboardAppearance, keyboardAppearance: keyboardAppearance,
enableInteractiveSelection: enableInteractiveSelection, enableInteractiveSelection: enableInteractiveSelection,
buildCounter: buildCounter, buildCounter: buildCounter,
autofillHints: autofillHints,
); );
}, },
); );
......
...@@ -425,4 +425,21 @@ void main() { ...@@ -425,4 +425,21 @@ void main() {
expect(find.text('initialValue'), findsNothing); expect(find.text('initialValue'), findsNothing);
expect(find.text('changedValue'), findsOneWidget); expect(find.text('changedValue'), findsOneWidget);
}); });
testWidgets('autofillHints is passed to super', (WidgetTester tester) async {
await tester.pumpWidget(
MaterialApp(
home: Material(
child: Center(
child: TextFormField(
autofillHints: const <String>[AutofillHints.countryName],
),
),
),
),
);
final TextField widget = tester.widget(find.byType(TextField));
expect(widget.autofillHints, equals(const <String>[AutofillHints.countryName]));
});
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment