-
Notifications
You must be signed in to change notification settings - Fork 30.2k
PlatformMenuBar erases default MacOS-supplied menus, provides no way to access them #162566
Description
Steps to reproduce
Adding a menu to a Mac app via PlatformMenuBar works fine, but completely replaces the default menus that are provided (either by native plugin or by MacOS) when you do not add a PlatformMenuBar.
With no PlatformMenuBar, the following menus appear (since MacOS requires all apps to have a menu bar):
- Application
-- about
-- hide app
-- hide others
-- quit - Edit
-- undo, redo, cut, copy, paste, autofill, select all, transformations, etc, etc... (all of which work when editing text in Flutter TextField) - View
-- enter full screen
-- show tab bar (which... what even is this for a flutter app??) - Window
-- move, resize, center, bring to front, full-screen, etc...
All of that is lost if you add your own PlatformMenuBar.
And most of those default menus provide OS-functionality that it is impossible to access/replicate from Flutter without trying to patch/cobble together third party native-platform packages. Some can't be replicated at all with any third party package.
Menu bar and access to OS-window-management features like this is too big a part of a Mac desktop application for all this to be left unimplemented and ignored.
Note that the PlatformProvidedMenuItem flutter class does provide access to a very small number of these items, but nowhere close to all. Nowhere near what's needed to be a "good Mac citizen" as a macOS desktop app.
Expected results
PlatformMenuBar, possibly via PlatformProvidedMenuItem widget, will provide a means for accessing all system-provided menus and their OS integration functionality.
Ideally, the PlatformMenuBar (or native plugin) will provide a means of augmenting the out-of-the-box OS menu bar and menu items, rather than completely replacing it and losing all that functionality.
Actual results
Adding a PlatformMenuBar with even a single menu item completely nukes the provided menu items, with no way to get them back.
Code sample
The PlatformMenuBar example code already demonstrates this. Run any macOS desktop flutter application without adding a PlatformMenuBar to see the default provided.
Screenshots or Video
No response
Logs
No response
Flutter Doctor output
bill@Mac-Mini-M2-Pro fractal_outliner % flutter doctor -v
[✓] Flutter (Channel stable, 3.27.1, on macOS 15.1.1 24B91 darwin-arm64, locale en-US)
• Flutter version 3.27.1 on channel stable at /Users/bill/development/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 17025dd (7 weeks ago), 2024-12-17 03:23:09 +0900
• Engine revision cb4b5fff73
• Dart version 3.6.0
• DevTools version 2.40.2
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at /Users/bill/Library/Android/sdk
• Platform android-34, build-tools 34.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11572160)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 16.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 16B40
• CocoaPods version 1.15.2
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2023.3)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11572160)
[✓] VS Code (version 1.96.4)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.102.0
[✓] Connected device (4 available)
• iPhone Mini (mobile) • 00008101-001E6D9A0188001E • ios • iOS 17.5.1 21F90
• macOS (desktop) • macos • darwin-arm64 • macOS 15.1.1 24B91 darwin-arm64
• Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin • macOS 15.1.1 24B91 darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 132.0.6834.111
[✓] Network resources
• All expected network resources are available.
• No issues found!
bill@Mac-Mini-M2-Pro fractal_outliner %