Skip to content

Commit fed50b1

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

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

packages/flutter/test/cupertino/button_test.dart

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1124,6 +1124,19 @@ void main() {
11241124
);
11251125
expect(text.text.style?.color, customForegroundColor);
11261126
});
1127+
1128+
testWidgets('CupertinoButton does not crash at zero area', (WidgetTester tester) async {
1129+
await tester.pumpWidget(
1130+
CupertinoApp(
1131+
home: Center(
1132+
child: SizedBox.shrink(
1133+
child: CupertinoButton(child: const Text('X'), onPressed: () {}),
1134+
),
1135+
),
1136+
),
1137+
);
1138+
expect(tester.getSize(find.byType(CupertinoButton)), Size.zero);
1139+
});
11271140
}
11281141

11291142
Widget boilerplate({required Widget child}) {

0 commit comments

Comments
 (0)