mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Make sure that a TextFormField doesn't crash in 0x0 environment (#178233)
This is my attempt to handle https://github.com/flutter/flutter/issues/6537 for the TextFormField widget.
This commit is contained in:
parent
5afc762e41
commit
1b40c01079
@ -1875,4 +1875,21 @@ void main() {
|
||||
.copyWith(enabled: true, hintMaxLines: 1);
|
||||
expect(decorator.decoration, expectedDecoration);
|
||||
});
|
||||
|
||||
testWidgets('TextFormField does not crash at zero area', (WidgetTester tester) async {
|
||||
tester.view.physicalSize = Size.zero;
|
||||
final TextEditingController controller = TextEditingController(text: 'X');
|
||||
addTearDown(tester.view.reset);
|
||||
addTearDown(controller.dispose);
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: Scaffold(
|
||||
body: Center(child: TextFormField(controller: controller)),
|
||||
),
|
||||
),
|
||||
);
|
||||
expect(tester.getSize(find.byType(TextFormField)), Size.zero);
|
||||
controller.selection = const TextSelection.collapsed(offset: 0);
|
||||
tester.pump();
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user