Unverified Commit 859aec59 authored by Chinmoy's avatar Chinmoy Committed by GitHub

Added scrollController property to TextFormField (#75169)

parent 438f44c7
......@@ -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);
});
}
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