Skip to content

Commit 246a6a2

Browse files
ahmedsameha1dkwingsmtvictorsanni
authored
Make sure that a BottomSheet doesn't crash in 0x0 environment (flutter#172229)
This is my attempt to handle flutter#6537 for the BottomSheet UI control. --------- Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com> Co-authored-by: Victor Sanni <victorsanniay@gmail.com>
1 parent 3f76120 commit 246a6a2

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

packages/flutter/test/material/bottom_sheet_test.dart

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2889,6 +2889,24 @@ void main() {
28892889
expect(FocusScope.of(tester.element(find.text('BottomSheet'))).hasFocus, false);
28902890
expect(focusNode.hasFocus, true);
28912891
});
2892+
2893+
testWidgets('BottomSheet does not crash at zero area', (WidgetTester tester) async {
2894+
await tester.pumpWidget(
2895+
MaterialApp(
2896+
home: Scaffold(
2897+
body: Center(
2898+
child: SizedBox.shrink(
2899+
child: BottomSheet(
2900+
onClosing: () {},
2901+
builder: (BuildContext context) => const Text('X'),
2902+
),
2903+
),
2904+
),
2905+
),
2906+
),
2907+
);
2908+
expect(tester.getSize(find.byType(BottomSheet)), Size.zero);
2909+
});
28922910
}
28932911

28942912
class _TestPage extends StatelessWidget {

0 commit comments

Comments
 (0)