Passes scrollPhysics (#48342)

This commit is contained in:
Prerak Mann 2020-01-14 06:38:01 +05:30 committed by Flutter GitHub Bot
parent ef62092b9b
commit 8b6b3b62c1
2 changed files with 24 additions and 0 deletions

View File

@ -124,6 +124,7 @@ class TextFormField extends FormField<String> {
EdgeInsets scrollPadding = const EdgeInsets.all(20.0),
bool enableInteractiveSelection = true,
InputCounterWidgetBuilder buildCounter,
ScrollPhysics scrollPhysics,
}) : assert(initialValue == null || controller == null),
assert(textAlign != null),
assert(autofocus != null),
@ -201,6 +202,7 @@ class TextFormField extends FormField<String> {
cursorRadius: cursorRadius,
cursorColor: cursorColor,
scrollPadding: scrollPadding,
scrollPhysics: scrollPhysics,
keyboardAppearance: keyboardAppearance,
enableInteractiveSelection: enableInteractiveSelection,
buildCounter: buildCounter,

View File

@ -32,6 +32,28 @@ void main() {
expect(textFieldWidget.textAlign, alignment);
});
testWidgets('Passes scrollPhysics to underlying TextField', (WidgetTester tester) async {
const ScrollPhysics scrollPhysics = ScrollPhysics();
await tester.pumpWidget(
MaterialApp(
home: Material(
child: Center(
child: TextFormField(
scrollPhysics: scrollPhysics,
),
),
),
),
);
final Finder textFieldFinder = find.byType(TextField);
expect(textFieldFinder, findsOneWidget);
final TextField textFieldWidget = tester.widget(textFieldFinder);
expect(textFieldWidget.scrollPhysics, scrollPhysics);
});
testWidgets('Passes textAlignVertical to underlying TextField', (WidgetTester tester) async {
const TextAlignVertical textAlignVertical = TextAlignVertical.bottom;