Files
flutter_server_box/macos/Runner/AppDelegate.swift
lxdklp 78ef181d4a feat: support macOS menubar (#976)
* feat: macOS menubar

* feat: Dynamic NavigateMenuItems

* fix: simplify shortcut config

* fix: Simplify the code

* fix: More suitable tab name
2025-12-10 18:05:30 +08:00

29 lines
952 B
Swift

import Cocoa
import FlutterMacOS
@main
class AppDelegate: FlutterAppDelegate {
override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
return true
}
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)
}
}