Skip to content

Commit 0c127ec

Browse files
Make sure that a Badge doesn't crash in 0x0 environment (flutter#172065)
This is my attempt to handle flutter#6537 for the Badge UI control. --------- Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
1 parent e316ed8 commit 0c127ec

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

packages/flutter/test/material/badge_test.dart

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,18 @@ void main() {
445445
expect(box, paints..rrect(rrect: RRect.fromLTRBR(0, -7, 30 + 8, 23, badgeRadius)));
446446
});
447447

448+
testWidgets('Badge renders at zero area', (WidgetTester tester) async {
449+
await tester.pumpWidget(
450+
const MaterialApp(
451+
home: Center(
452+
child: SizedBox.shrink(child: Badge(label: Text('X'))),
453+
),
454+
),
455+
);
456+
final Finder label = find.text('X');
457+
expect(tester.getSize(label), Size.zero);
458+
});
459+
448460
testWidgets('Badge.count maxCount limits displayed value', (WidgetTester tester) async {
449461
Widget buildFrame(int count, [int maxCount = 999]) {
450462
return MaterialApp(

0 commit comments

Comments
 (0)