Skip to content

Commit 4ddd558

Browse files
ahmedsameha1dkwingsmtvictorsanni
authored
Make sure that SimpleDialog and SimpleDialogOption do not crash in 0x0 environment (flutter#174229)
This is my attempt to handle flutter#6537 for SimpleDialog and SimpleDialogOption UI controls. --------- Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com> Co-authored-by: Victor Sanni <victorsanniay@gmail.com>
1 parent abac27d commit 4ddd558

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

packages/flutter/test/material/dialog_test.dart

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3022,6 +3022,30 @@ void main() {
30223022
expect(find.byType(CloseButton), findsOneWidget);
30233023
});
30243024

3025+
testWidgets('SimpleDialog does not crash at zero area', (WidgetTester tester) async {
3026+
await tester.pumpWidget(
3027+
const MaterialApp(
3028+
home: Center(
3029+
child: SizedBox.shrink(child: SimpleDialog(title: Text('X'))),
3030+
),
3031+
),
3032+
);
3033+
expect(tester.getSize(find.byType(SimpleDialog)), Size.zero);
3034+
});
3035+
3036+
testWidgets('SimpleDialogOption does not crash at zero area', (WidgetTester tester) async {
3037+
await tester.pumpWidget(
3038+
const MaterialApp(
3039+
home: Material(
3040+
child: Center(
3041+
child: SizedBox.shrink(child: SimpleDialogOption(child: Text('X'))),
3042+
),
3043+
),
3044+
),
3045+
);
3046+
expect(tester.getSize(find.byType(SimpleDialogOption)), Size.zero);
3047+
});
3048+
30253049
testWidgets('Dialog does not crash at zero area', (WidgetTester tester) async {
30263050
await tester.pumpWidget(
30273051
const MaterialApp(

0 commit comments

Comments
 (0)