mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Make sure that an InputChip doesn't crash in 0x0 environment (#175930)
This is my attempt to handle https://github.com/flutter/flutter/issues/6537 for the InputChip widget. --------- Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
This commit is contained in:
parent
6d541a1c67
commit
ef158c39a3
@ -688,4 +688,26 @@ void main() {
|
||||
SystemMouseCursors.forbidden,
|
||||
);
|
||||
});
|
||||
|
||||
testWidgets('InputChip does not crash at zero area', (WidgetTester tester) async {
|
||||
Future<void> testChip(Widget chip) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: Scaffold(
|
||||
body: Center(child: SizedBox.shrink(child: chip)),
|
||||
),
|
||||
),
|
||||
);
|
||||
expect(tester.getSize(find.byType(InputChip)), Size.zero);
|
||||
}
|
||||
|
||||
await testChip(const InputChip(label: Text('X')));
|
||||
await testChip(
|
||||
const InputChip(
|
||||
label: Text('X'),
|
||||
avatar: CircleAvatar(child: Text('A')),
|
||||
),
|
||||
);
|
||||
await testChip(InputChip(label: const Text('X'), onDeleted: () {}));
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user