Unverified Commit 406d86b4 authored by Greg Spencer's avatar Greg Spencer Committed by GitHub

PlatformMenuBar changes to bring it into line with upcoming MenuBar implementation (#104565)

When I was doing the MenuBar implementation, I made some changes to the PlatformMenuBar to allow it to understand shortcuts a little more, and to deprecate the body parameter rename it to child to match most other widgets.

These are those changes, separated out because they are separable, and I'm trying to make the MenuBar PR smaller.
parent 6efdf0ae
...@@ -126,7 +126,7 @@ class _MyMenuBarAppState extends State<MyMenuBarApp> { ...@@ -126,7 +126,7 @@ class _MyMenuBarAppState extends State<MyMenuBarApp> {
], ],
), ),
], ],
body: Center( child: Center(
child: Text(_showMessage child: Text(_showMessage
? _message ? _message
: 'This space intentionally left blank.\n' : 'This space intentionally left blank.\n'
......
...@@ -51,7 +51,6 @@ void main() { ...@@ -51,7 +51,6 @@ void main() {
MaterialApp( MaterialApp(
home: Material( home: Material(
child: PlatformMenuBar( child: PlatformMenuBar(
body: const Center(child: Text('Body')),
menus: createTestMenus( menus: createTestMenus(
onActivate: onActivate, onActivate: onActivate,
onOpen: onOpen, onOpen: onOpen,
...@@ -63,6 +62,7 @@ void main() { ...@@ -63,6 +62,7 @@ void main() {
subSubMenu10[3]: const SingleActivator(LogicalKeyboardKey.keyD, meta: true), subSubMenu10[3]: const SingleActivator(LogicalKeyboardKey.keyD, meta: true),
}, },
), ),
child: const Center(child: Text('Body')),
), ),
), ),
), ),
...@@ -163,11 +163,11 @@ void main() { ...@@ -163,11 +163,11 @@ void main() {
const MaterialApp( const MaterialApp(
home: Material( home: Material(
child: PlatformMenuBar( child: PlatformMenuBar(
body: PlatformMenuBar(
body: SizedBox(),
menus: <MenuItem>[], menus: <MenuItem>[],
), child: PlatformMenuBar(
menus: <MenuItem>[], menus: <MenuItem>[],
child: SizedBox(),
),
), ),
), ),
), ),
...@@ -180,8 +180,8 @@ void main() { ...@@ -180,8 +180,8 @@ void main() {
shortcut: SingleActivator(LogicalKeyboardKey.keyA), shortcut: SingleActivator(LogicalKeyboardKey.keyA),
); );
const PlatformMenuBar menuBar = PlatformMenuBar( const PlatformMenuBar menuBar = PlatformMenuBar(
body: SizedBox(),
menus: <MenuItem>[item], menus: <MenuItem>[item],
child: SizedBox(),
); );
await tester.pumpWidget( await tester.pumpWidget(
...@@ -197,7 +197,7 @@ void main() { ...@@ -197,7 +197,7 @@ void main() {
menuBar.toStringDeep(), menuBar.toStringDeep(),
equalsIgnoringHashCodes( equalsIgnoringHashCodes(
'PlatformMenuBar#00000\n' 'PlatformMenuBar#00000\n'
' └─PlatformMenuItem#00000\n' ' └─PlatformMenuItem#00000(label2)\n'
' label: "label2"\n' ' label: "label2"\n'
' shortcut: SingleActivator#00000(keys: Key A)\n' ' shortcut: SingleActivator#00000(keys: Key A)\n'
' DISABLED\n', ' DISABLED\n',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment