mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Make sure that a SearchBar doesn't crash in 0x0 environment (#177761)
This is my attempt to handle https://github.com/flutter/flutter/issues/6537 for the SearchBar widget.
This commit is contained in:
parent
5e348fd892
commit
15d2e56b4e
@ -4280,6 +4280,22 @@ void main() {
|
||||
expect(viewTextField.smartDashesType, SmartDashesType.disabled);
|
||||
expect(viewTextField.smartQuotesType, SmartQuotesType.disabled);
|
||||
});
|
||||
|
||||
testWidgets('SearchBar does not crash at zero area', (WidgetTester tester) async {
|
||||
tester.view.physicalSize = Size.zero;
|
||||
final TextEditingController controller = TextEditingController(text: 'X');
|
||||
addTearDown(controller.dispose);
|
||||
addTearDown(tester.view.reset);
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: Center(child: SearchBar(controller: controller)),
|
||||
),
|
||||
);
|
||||
expect(tester.getSize(find.byType(SearchBar)), Size.zero);
|
||||
controller.selection = const TextSelection.collapsed(offset: 0);
|
||||
await tester.pump();
|
||||
expect(find.text('X'), findsOne);
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> checkSearchBarDefaults(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user