Skip to content

Commit c30e5d4

Browse files
Make sure that a FilledButton doesn't crash in 0x0 environment (flutter#175110)
This is my attempt to handle flutter#6537 for the FilledButton widget. Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
1 parent 46c3f84 commit c30e5d4

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

packages/flutter/test/material/filled_button_test.dart

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2862,6 +2862,19 @@ void main() {
28622862
expect(iconStyle(tester, buttonIcon).color, hoveredColor);
28632863
});
28642864

2865+
testWidgets('FilledButton does not crash at zero area', (WidgetTester tester) async {
2866+
await tester.pumpWidget(
2867+
MaterialApp(
2868+
home: Center(
2869+
child: SizedBox.shrink(
2870+
child: FilledButton(onPressed: () {}, child: const Text('X')),
2871+
),
2872+
),
2873+
),
2874+
);
2875+
expect(tester.getSize(find.byType(FilledButton)), Size.zero);
2876+
});
2877+
28652878
testWidgets('When a FilledButton gains an icon, preserves the same SemanticsNode id', (
28662879
WidgetTester tester,
28672880
) async {

0 commit comments

Comments
 (0)