Skip to content

Commit f07d882

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

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

packages/flutter/test/material/popup_menu_test.dart

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4851,6 +4851,19 @@ void main() {
48514851
checkPopupMenu(popupMenuTheme2);
48524852
});
48534853

4854+
testWidgets('PopupMenuItem does not crash at zero area', (WidgetTester tester) async {
4855+
await tester.pumpWidget(
4856+
const MaterialApp(
4857+
home: Scaffold(
4858+
body: Center(
4859+
child: SizedBox.shrink(child: PopupMenuItem<String>(child: Text('X'))),
4860+
),
4861+
),
4862+
),
4863+
);
4864+
expect(tester.getSize(find.byType(PopupMenuItem<String>)), Size.zero);
4865+
});
4866+
48544867
testWidgets('PopupMenuButton does not crash at zero area', (WidgetTester tester) async {
48554868
// This test case only verifies the layout of the button itself, not the
48564869
// overlay, because there doesn't seem to be a way to open the menu at zero

0 commit comments

Comments
 (0)