Skip to content

Commit 93999e1

Browse files
Make sure that an IconButton doesn't crash in 0x0 environment (flutter#175372)
This is my attempt to handle flutter#6537 for the IconButton widget. Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
1 parent 95900da commit 93999e1

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

packages/flutter/test/material/icon_button_test.dart

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3558,6 +3558,19 @@ void main() {
35583558
),
35593559
);
35603560
});
3561+
3562+
testWidgets('IconButton does not crash at zero area', (WidgetTester tester) async {
3563+
await tester.pumpWidget(
3564+
MaterialApp(
3565+
home: Center(
3566+
child: SizedBox.shrink(
3567+
child: IconButton(onPressed: () {}, icon: const Icon(Icons.add)),
3568+
),
3569+
),
3570+
),
3571+
);
3572+
expect(tester.getSize(find.byType(IconButton)), Size.zero);
3573+
});
35613574
}
35623575

35633576
Widget buildAllVariants({

0 commit comments

Comments
 (0)