mirror of
https://github.com/flutter/flutter
synced 2024-10-14 04:02:56 +00:00
Add autofill support for TextFormField (#57332)
This commit is contained in:
parent
e8a7dc466b
commit
07f9563dac
|
@ -174,6 +174,7 @@ class TextFormField extends FormField<String> {
|
|||
bool enableInteractiveSelection = true,
|
||||
InputCounterWidgetBuilder buildCounter,
|
||||
ScrollPhysics scrollPhysics,
|
||||
Iterable<String> autofillHints,
|
||||
}) : assert(initialValue == null || controller == null),
|
||||
assert(textAlign != null),
|
||||
assert(autofocus != null),
|
||||
|
@ -257,6 +258,7 @@ class TextFormField extends FormField<String> {
|
|||
keyboardAppearance: keyboardAppearance,
|
||||
enableInteractiveSelection: enableInteractiveSelection,
|
||||
buildCounter: buildCounter,
|
||||
autofillHints: autofillHints,
|
||||
);
|
||||
},
|
||||
);
|
||||
|
|
|
@ -425,4 +425,21 @@ void main() {
|
|||
expect(find.text('initialValue'), findsNothing);
|
||||
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]));
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue