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:
Ahmed Mohamed Sameh 2025-10-10 08:42:24 +03:00 committed by GitHub
parent 6d541a1c67
commit ef158c39a3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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: () {}));
});
}