Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
cd98c49c
Unverified
Commit
cd98c49c
authored
Aug 16, 2022
by
Greg Spencer
Committed by
GitHub
Aug 16, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some changes needed to PlatformMenuBar before the MenuBar implementation change lands. (#109556)
parent
bacab7ee
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
120 additions
and
184 deletions
+120
-184
platform_menu_bar.0.dart
...i/lib/material/platform_menu_bar/platform_menu_bar.0.dart
+5
-5
system_channels.dart
packages/flutter/lib/src/services/system_channels.dart
+1
-1
platform_menu_bar.dart
packages/flutter/lib/src/widgets/platform_menu_bar.dart
+98
-162
platform_menu_bar_test.dart
packages/flutter/test/widgets/platform_menu_bar_test.dart
+16
-16
No files found.
examples/api/lib/material/platform_menu_bar/platform_menu_bar.0.dart
View file @
cd98c49c
...
...
@@ -73,12 +73,12 @@ class _MyMenuBarAppState extends State<MyMenuBarApp> {
// │ └ There's a million things I haven't done, but just you wait.
// └ Quit
return
PlatformMenuBar
(
menus:
<
MenuItem
>[
menus:
<
Platform
MenuItem
>[
PlatformMenu
(
label:
'Flutter API Sample'
,
menus:
<
MenuItem
>[
menus:
<
Platform
MenuItem
>[
PlatformMenuItemGroup
(
members:
<
MenuItem
>[
members:
<
Platform
MenuItem
>[
PlatformMenuItem
(
label:
'About'
,
onSelected:
()
{
...
...
@@ -88,7 +88,7 @@ class _MyMenuBarAppState extends State<MyMenuBarApp> {
],
),
PlatformMenuItemGroup
(
members:
<
MenuItem
>[
members:
<
Platform
MenuItem
>[
PlatformMenuItem
(
onSelected:
()
{
_handleMenuSelection
(
MenuSelection
.
showMessage
);
...
...
@@ -98,7 +98,7 @@ class _MyMenuBarAppState extends State<MyMenuBarApp> {
),
PlatformMenu
(
label:
'Messages'
,
menus:
<
MenuItem
>[
menus:
<
Platform
MenuItem
>[
PlatformMenuItem
(
label:
'I am not throwing away my shot.'
,
shortcut:
const
SingleActivator
(
LogicalKeyboardKey
.
digit1
,
meta:
true
),
...
...
packages/flutter/lib/src/services/system_channels.dart
View file @
cd98c49c
...
...
@@ -406,7 +406,7 @@ class SystemChannels {
/// encoding the list of top level menu items in window "0", which each
/// have a hierarchy of `Map<String, Object?>` containing the required
/// data, sent via a [StandardMessageCodec]. It is typically generated from
/// a list of [MenuItem]s, and ends up looking like this example:
/// a list of [
Platform
MenuItem]s, and ends up looking like this example:
///
/// ```dart
/// Map<String, Object?> menu = <String, Object?>{
...
...
packages/flutter/lib/src/widgets/platform_menu_bar.dart
View file @
cd98c49c
This diff is collapsed.
Click to expand it.
packages/flutter/test/widgets/platform_menu_bar_test.dart
View file @
cd98c49c
...
...
@@ -163,9 +163,9 @@ void main() {
const
MaterialApp
(
home:
Material
(
child:
PlatformMenuBar
(
menus:
<
MenuItem
>[],
menus:
<
Platform
MenuItem
>[],
child:
PlatformMenuBar
(
menus:
<
MenuItem
>[],
menus:
<
Platform
MenuItem
>[],
child:
SizedBox
(),
),
),
...
...
@@ -180,7 +180,7 @@ void main() {
shortcut:
SingleActivator
(
LogicalKeyboardKey
.
keyA
),
);
const
PlatformMenuBar
menuBar
=
PlatformMenuBar
(
menus:
<
MenuItem
>[
item
],
menus:
<
Platform
MenuItem
>[
item
],
child:
SizedBox
(),
);
...
...
@@ -205,14 +205,14 @@ void main() {
);
});
});
group
(
'
Platform
MenuBarItem'
,
()
{
group
(
'MenuBarItem'
,
()
{
testWidgets
(
'diagnostics'
,
(
WidgetTester
tester
)
async
{
const
PlatformMenuItem
childItem
=
PlatformMenuItem
(
label:
'label'
,
);
const
PlatformMenu
item
=
PlatformMenu
(
label:
'label'
,
menus:
<
MenuItem
>[
childItem
],
menus:
<
Platform
MenuItem
>[
childItem
],
);
final
DiagnosticPropertiesBuilder
builder
=
DiagnosticPropertiesBuilder
();
...
...
@@ -258,19 +258,19 @@ const List<String> subMenu2 = <String>[
'Sub Menu 20'
,
];
List
<
MenuItem
>
createTestMenus
({
List
<
Platform
MenuItem
>
createTestMenus
({
void
Function
(
String
)?
onActivate
,
void
Function
(
String
)?
onOpen
,
void
Function
(
String
)?
onClose
,
Map
<
String
,
MenuSerializableShortcut
>
shortcuts
=
const
<
String
,
MenuSerializableShortcut
>{},
bool
includeStandard
=
false
,
})
{
final
List
<
MenuItem
>
result
=
<
MenuItem
>[
final
List
<
PlatformMenuItem
>
result
=
<
Platform
MenuItem
>[
PlatformMenu
(
label:
mainMenu
[
0
],
onOpen:
onOpen
!=
null
?
()
=>
onOpen
(
mainMenu
[
0
])
:
null
,
onClose:
onClose
!=
null
?
()
=>
onClose
(
mainMenu
[
0
])
:
null
,
menus:
<
MenuItem
>[
menus:
<
Platform
MenuItem
>[
PlatformMenuItem
(
label:
subMenu0
[
0
],
onSelected:
onActivate
!=
null
?
()
=>
onActivate
(
subMenu0
[
0
])
:
null
,
...
...
@@ -282,9 +282,9 @@ List<MenuItem> createTestMenus({
label:
mainMenu
[
1
],
onOpen:
onOpen
!=
null
?
()
=>
onOpen
(
mainMenu
[
1
])
:
null
,
onClose:
onClose
!=
null
?
()
=>
onClose
(
mainMenu
[
1
])
:
null
,
menus:
<
MenuItem
>[
menus:
<
Platform
MenuItem
>[
PlatformMenuItemGroup
(
members:
<
MenuItem
>[
members:
<
Platform
MenuItem
>[
PlatformMenuItem
(
label:
subMenu1
[
0
],
onSelected:
onActivate
!=
null
?
()
=>
onActivate
(
subMenu1
[
0
])
:
null
,
...
...
@@ -296,9 +296,9 @@ List<MenuItem> createTestMenus({
label:
subMenu1
[
1
],
onOpen:
onOpen
!=
null
?
()
=>
onOpen
(
subMenu1
[
1
])
:
null
,
onClose:
onClose
!=
null
?
()
=>
onClose
(
subMenu1
[
1
])
:
null
,
menus:
<
MenuItem
>[
menus:
<
Platform
MenuItem
>[
PlatformMenuItemGroup
(
members:
<
MenuItem
>[
members:
<
Platform
MenuItem
>[
PlatformMenuItem
(
label:
subSubMenu10
[
0
],
onSelected:
onActivate
!=
null
?
()
=>
onActivate
(
subSubMenu10
[
0
])
:
null
,
...
...
@@ -307,7 +307,7 @@ List<MenuItem> createTestMenus({
],
),
PlatformMenuItemGroup
(
members:
<
MenuItem
>[
members:
<
Platform
MenuItem
>[
PlatformMenuItem
(
label:
subSubMenu10
[
1
],
onSelected:
onActivate
!=
null
?
()
=>
onActivate
(
subSubMenu10
[
1
])
:
null
,
...
...
@@ -321,7 +321,7 @@ List<MenuItem> createTestMenus({
shortcut:
shortcuts
[
subSubMenu10
[
2
]],
),
PlatformMenuItemGroup
(
members:
<
MenuItem
>[
members:
<
Platform
MenuItem
>[
PlatformMenuItem
(
label:
subSubMenu10
[
3
],
onSelected:
onActivate
!=
null
?
()
=>
onActivate
(
subSubMenu10
[
3
])
:
null
,
...
...
@@ -342,7 +342,7 @@ List<MenuItem> createTestMenus({
label:
mainMenu
[
2
],
onOpen:
onOpen
!=
null
?
()
=>
onOpen
(
mainMenu
[
2
])
:
null
,
onClose:
onClose
!=
null
?
()
=>
onClose
(
mainMenu
[
2
])
:
null
,
menus:
<
MenuItem
>[
menus:
<
Platform
MenuItem
>[
PlatformMenuItem
(
// Always disabled.
label:
subMenu2
[
0
],
...
...
@@ -355,7 +355,7 @@ List<MenuItem> createTestMenus({
label:
mainMenu
[
3
],
onOpen:
onOpen
!=
null
?
()
=>
onOpen
(
mainMenu
[
2
])
:
null
,
onClose:
onClose
!=
null
?
()
=>
onClose
(
mainMenu
[
2
])
:
null
,
menus:
<
MenuItem
>[],
menus:
<
Platform
MenuItem
>[],
),
];
return
result
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment