File tree Expand file tree Collapse file tree 10 files changed +79
-7
lines changed Expand file tree Collapse file tree 10 files changed +79
-7
lines changed Original file line number Diff line number Diff line change @@ -101,8 +101,9 @@ class MenuApp extends StatelessWidget {
101
101
102
102
@override
103
103
Widget build (BuildContext context) {
104
- return const MaterialApp (
105
- home: Scaffold (body: MyCheckboxMenu (message: kMessage)),
104
+ return MaterialApp (
105
+ theme: ThemeData (useMaterial3: true ),
106
+ home: const Scaffold (body: SafeArea (child: MyCheckboxMenu (message: kMessage))),
106
107
);
107
108
}
108
109
}
Original file line number Diff line number Diff line change @@ -110,7 +110,7 @@ class MenuAcceleratorApp extends StatelessWidget {
110
110
debugDumpApp ();
111
111
}),
112
112
},
113
- child: const Scaffold (body: MyMenuBar ()),
113
+ child: const Scaffold (body: SafeArea (child : MyMenuBar () )),
114
114
),
115
115
);
116
116
}
Original file line number Diff line number Diff line change @@ -204,7 +204,7 @@ class MenuApp extends StatelessWidget {
204
204
Widget build (BuildContext context) {
205
205
return MaterialApp (
206
206
theme: ThemeData (useMaterial3: true ),
207
- home: const Scaffold (body: MyCascadingMenu (message: kMessage)),
207
+ home: const Scaffold (body: SafeArea (child : MyCascadingMenu (message: kMessage) )),
208
208
);
209
209
}
210
210
}
Original file line number Diff line number Diff line change @@ -230,7 +230,7 @@ class MenuBarApp extends StatelessWidget {
230
230
@override
231
231
Widget build (BuildContext context) {
232
232
return const MaterialApp (
233
- home: Scaffold (body: MyMenuBar (message: kMessage)),
233
+ home: Scaffold (body: SafeArea (child : MyMenuBar (message: kMessage) )),
234
234
);
235
235
}
236
236
}
Original file line number Diff line number Diff line change @@ -107,8 +107,9 @@ class MenuApp extends StatelessWidget {
107
107
108
108
@override
109
109
Widget build (BuildContext context) {
110
- return const MaterialApp (
111
- home: Scaffold (body: MyRadioMenu ()),
110
+ return MaterialApp (
111
+ theme: ThemeData (useMaterial3: true ),
112
+ home: const Scaffold (body: SafeArea (child: MyRadioMenu ())),
112
113
);
113
114
}
114
115
}
Original file line number Diff line number Diff line change @@ -24,4 +24,18 @@ void main() {
24
24
expect (find.text ('Show Message' ), findsNothing);
25
25
expect (find.text (example.MenuApp .kMessage), findsOneWidget);
26
26
});
27
+
28
+ testWidgets ('MenuAnchor is wrapped in a SafeArea' , (WidgetTester tester) async {
29
+ const double safeAreaPadding = 100.0 ;
30
+ await tester.pumpWidget (
31
+ const MediaQuery (
32
+ data: MediaQueryData (
33
+ padding: EdgeInsets .symmetric (vertical: safeAreaPadding),
34
+ ),
35
+ child: example.MenuApp (),
36
+ ),
37
+ );
38
+
39
+ expect (tester.getTopLeft (find.byType (MenuAnchor )), const Offset (0.0 , safeAreaPadding));
40
+ });
27
41
}
Original file line number Diff line number Diff line change @@ -51,4 +51,18 @@ void main() {
51
51
await tester.pumpAndSettle ();
52
52
expect (find.text ('Close' ), findsNothing);
53
53
});
54
+
55
+ testWidgets ('MenuBar is wrapped in a SafeArea' , (WidgetTester tester) async {
56
+ const double safeAreaPadding = 100.0 ;
57
+ await tester.pumpWidget (
58
+ const MediaQuery (
59
+ data: MediaQueryData (
60
+ padding: EdgeInsets .symmetric (vertical: safeAreaPadding),
61
+ ),
62
+ child: example.MenuAcceleratorApp (),
63
+ ),
64
+ );
65
+
66
+ expect (tester.getTopLeft (find.byType (MenuBar )), const Offset (0.0 , safeAreaPadding));
67
+ });
54
68
}
Original file line number Diff line number Diff line change @@ -104,4 +104,18 @@ void main() {
104
104
105
105
expect (find.text ('Last Selected: ${example .MenuEntry .colorBlue .label }' ), findsOneWidget);
106
106
});
107
+
108
+ testWidgets ('MenuAnchor is wrapped in a SafeArea' , (WidgetTester tester) async {
109
+ const double safeAreaPadding = 100.0 ;
110
+ await tester.pumpWidget (
111
+ const MediaQuery (
112
+ data: MediaQueryData (
113
+ padding: EdgeInsets .symmetric (vertical: safeAreaPadding),
114
+ ),
115
+ child: example.MenuApp (),
116
+ ),
117
+ );
118
+
119
+ expect (tester.getTopLeft (find.byType (MenuAnchor )), const Offset (0.0 , safeAreaPadding));
120
+ });
107
121
}
Original file line number Diff line number Diff line change @@ -91,4 +91,18 @@ void main() {
91
91
92
92
expect (find.text ('Last Selected: Blue Background' ), findsOneWidget);
93
93
});
94
+
95
+ testWidgets ('MenuBar is wrapped in a SafeArea' , (WidgetTester tester) async {
96
+ const double safeAreaPadding = 100.0 ;
97
+ await tester.pumpWidget (
98
+ const MediaQuery (
99
+ data: MediaQueryData (
100
+ padding: EdgeInsets .symmetric (vertical: safeAreaPadding),
101
+ ),
102
+ child: example.MenuBarApp (),
103
+ ),
104
+ );
105
+
106
+ expect (tester.getTopLeft (find.byType (MenuBar )), const Offset (0.0 , safeAreaPadding));
107
+ });
94
108
}
Original file line number Diff line number Diff line change @@ -74,4 +74,18 @@ void main() {
74
74
expect (tester.widget <Radio <Color >>(find.descendant (of: find.byType (RadioMenuButton <Color >).at (2 ), matching: find.byType (Radio <Color >))).groupValue, equals (Colors .blue));
75
75
expect (tester.widget <Container >(find.byType (Container )).color, equals (Colors .blue));
76
76
});
77
+
78
+ testWidgets ('MenuAnchor is wrapped in a SafeArea' , (WidgetTester tester) async {
79
+ const double safeAreaPadding = 100.0 ;
80
+ await tester.pumpWidget (
81
+ const MediaQuery (
82
+ data: MediaQueryData (
83
+ padding: EdgeInsets .symmetric (vertical: safeAreaPadding),
84
+ ),
85
+ child: example.MenuApp (),
86
+ ),
87
+ );
88
+
89
+ expect (tester.getTopLeft (find.byType (MenuAnchor )), const Offset (0.0 , safeAreaPadding));
90
+ });
77
91
}
You can’t perform that action at this time.
0 commit comments