Make sure that a MaterialBanner doesn't crash in 0x0 environment (#172074)

This is my attempt to handle #6537 for the MaterialBanner UI control.
This commit is contained in:
Ahmed Mohamed Sameh 2025-07-25 00:01:06 +03:00 committed by GitHub
parent 28f63a398d
commit c2106147e2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1207,6 +1207,20 @@ void main() {
final Size materialBarSize = tester.getSize(find.byType(MaterialBanner));
expect(materialBarSize.height, equals(minActionBarHeight));
});
testWidgets('MaterialBanner renders at zero size', (WidgetTester tester) async {
await tester.pumpWidget(
const MaterialApp(
home: Center(
child: SizedBox.shrink(
child: MaterialBanner(content: Text('X'), actions: <Widget>[SizedBox.shrink()]),
),
),
),
);
final Finder content = find.text('X');
expect(tester.getSize(content).isEmpty, isTrue);
});
}
Material _getMaterialFromBanner(WidgetTester tester) {