Added scrollController property to TextFormField (#75169)
This commit is contained in:
parent
438f44c7dc
commit
859aec592f
@ -193,6 +193,7 @@ class TextFormField extends FormField<String> {
|
||||
ScrollPhysics? scrollPhysics,
|
||||
Iterable<String>? autofillHints,
|
||||
AutovalidateMode? autovalidateMode,
|
||||
ScrollController? scrollController,
|
||||
}) : assert(initialValue == null || controller == null),
|
||||
assert(textAlign != null),
|
||||
assert(autofocus != null),
|
||||
@ -291,6 +292,7 @@ class TextFormField extends FormField<String> {
|
||||
selectionControls: selectionControls,
|
||||
buildCounter: buildCounter,
|
||||
autofillHints: autofillHints,
|
||||
scrollController: scrollController,
|
||||
);
|
||||
},
|
||||
);
|
||||
|
@ -727,4 +727,26 @@ void main() {
|
||||
final TextDirection textDirection = Directionality.of(context);
|
||||
expect(textDirection, TextDirection.rtl);
|
||||
});
|
||||
|
||||
testWidgets('Passes scrollController to underlying TextField', (WidgetTester tester) async {
|
||||
final ScrollController scrollController = ScrollController();
|
||||
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: Material(
|
||||
child: Center(
|
||||
child: TextFormField(
|
||||
scrollController: scrollController,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
final Finder textFieldFinder = find.byType(TextField);
|
||||
expect(textFieldFinder, findsOneWidget);
|
||||
|
||||
final TextField textFieldWidget = tester.widget(textFieldFinder);
|
||||
expect(textFieldWidget.scrollController, scrollController);
|
||||
});
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user