mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Make sure that a PopupMenuItem doesn't crash in 0x0 environment (#177533)
This is my attempt to handle https://github.com/flutter/flutter/issues/6537 for the PopupMenuItem widget. Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
This commit is contained in:
parent
50d03ed339
commit
f07d882efb
@ -4851,6 +4851,19 @@ void main() {
|
||||
checkPopupMenu(popupMenuTheme2);
|
||||
});
|
||||
|
||||
testWidgets('PopupMenuItem does not crash at zero area', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const MaterialApp(
|
||||
home: Scaffold(
|
||||
body: Center(
|
||||
child: SizedBox.shrink(child: PopupMenuItem<String>(child: Text('X'))),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
expect(tester.getSize(find.byType(PopupMenuItem<String>)), Size.zero);
|
||||
});
|
||||
|
||||
testWidgets('PopupMenuButton does not crash at zero area', (WidgetTester tester) async {
|
||||
// This test case only verifies the layout of the button itself, not the
|
||||
// overlay, because there doesn't seem to be a way to open the menu at zero
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user