feat: support macOS menubar (#976)

* feat: macOS menubar

* feat: Dynamic NavigateMenuItems

* fix: simplify shortcut config

* fix: Simplify the code

* fix: More suitable tab name
This commit is contained in:
lxdklp
2025-12-10 18:05:30 +08:00
committed by GitHub
parent 3f15caeaf2
commit 78ef181d4a
19 changed files with 459 additions and 3 deletions

View File

@@ -10,4 +10,19 @@ class AppDelegate: FlutterAppDelegate {
override func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool {
return true
}
override func applicationDidFinishLaunching(_ notification: Notification) {
if let controller = mainFlutterWindow?.contentViewController as? FlutterViewController {
let channel = FlutterMethodChannel(name: "about", binaryMessenger: controller.engine.binaryMessenger)
channel.setMethodCallHandler { (call: FlutterMethodCall, result: @escaping FlutterResult) in
if call.method == "showAboutPanel" {
NSApp.orderFrontStandardAboutPanel(nil)
result(nil)
} else {
result(FlutterMethodNotImplemented)
}
}
}
super.applicationDidFinishLaunching(notification)
}
}