mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Make sure that a RadioMenuButton doesn't crash in 0x0 environment (#176516)
This is my attempt to handle https://github.com/flutter/flutter/issues/6537 for the RadioMenuButton widget. Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
This commit is contained in:
parent
a2a56c2939
commit
e055ca0b91
@ -5097,6 +5097,41 @@ void main() {
|
||||
expect(tester.getRect(findMenuPanels()).width, 800.0 - reservedPadding.horizontal);
|
||||
});
|
||||
|
||||
testWidgets('CheckboxMenuButton does not crash at zero area', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: Center(
|
||||
child: SizedBox.shrink(
|
||||
child: CheckboxMenuButton(
|
||||
value: true,
|
||||
onChanged: (bool? value) {},
|
||||
child: const Text('X'),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
expect(tester.getSize(find.byType(CheckboxMenuButton)), Size.zero);
|
||||
});
|
||||
|
||||
testWidgets('RadioMenuButton does not crash at zero area', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: Center(
|
||||
child: SizedBox.shrink(
|
||||
child: RadioMenuButton<bool>(
|
||||
value: true,
|
||||
groupValue: true,
|
||||
onChanged: (bool? value) {},
|
||||
child: null,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
expect(tester.getSize(find.byType(RadioMenuButton<bool>)), Size.zero);
|
||||
});
|
||||
|
||||
testWidgets('Layout updates when reserved padding changes', (WidgetTester tester) async {
|
||||
const EdgeInsetsGeometry reservedPadding = EdgeInsets.symmetric(horizontal: 13.0);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user