diff --git a/auth/lib/ui/home_page.dart b/auth/lib/ui/home_page.dart index b81402439b..98ee15cfc1 100644 --- a/auth/lib/ui/home_page.dart +++ b/auth/lib/ui/home_page.dart @@ -338,8 +338,8 @@ class _HomePageState extends State { _searchText = _textController.text; // Request focus on the search box - // For Windows only for now. "Platform.isWindows" can be removed if other platforms has been tested. - if (Platform.isWindows) { + // For Windows and macOS only for now. This if statement can be removed if other platforms has been tested. + if (Platform.isWindows || Platform.isMacOS) { searchBoxFocusNode.requestFocus(); } } diff --git a/auth/macos/Runner/AppDelegate.swift b/auth/macos/Runner/AppDelegate.swift index a6f73a80ad..0f8f95c206 100644 --- a/auth/macos/Runner/AppDelegate.swift +++ b/auth/macos/Runner/AppDelegate.swift @@ -3,6 +3,13 @@ import FlutterMacOS @main class AppDelegate: FlutterAppDelegate { + override func applicationShouldHandleReopen(_ sender: NSApplication, hasVisibleWindows flag: Bool) -> Bool { + if !flag { + sender.windows.first?.makeKeyAndOrderFront(self) + } + return true + } + override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { return false }