From aa614a68a56d356e123a929a66b5e3ebd160a917 Mon Sep 17 00:00:00 2001 From: LOSSES Don <1384036+Losses@users.noreply.github.com> Date: Mon, 25 Nov 2024 19:29:03 +0800 Subject: [PATCH] fix: Fix #112 --- lib/main.dart | 2 ++ lib/widgets/window_buttons.dart | 27 +++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/lib/main.dart b/lib/main.dart index a53aadf3a..b8d122004 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -65,6 +65,7 @@ import 'theme.dart'; late bool disableBrandingAnimation; late String? initialPath; +late bool isWindows11; void main(List arguments) async { WidgetsFlutterBinding.ensureInitialized(); @@ -84,6 +85,7 @@ void main(List arguments) async { final DeviceInfoPlugin deviceInfo = DeviceInfoPlugin(); final windowsInfo = await deviceInfo.windowsInfo; final isWindows10 = windowsInfo.productName.startsWith('Windows 10'); + isWindows11 = windowsInfo.productName.startsWith('Windows 11'); if (isWindows10 && appTheme.windowEffect == WindowEffect.mica) { appTheme.windowEffect = WindowEffect.solid; diff --git a/lib/widgets/window_buttons.dart b/lib/widgets/window_buttons.dart index a10338b7c..afd20b3b3 100644 --- a/lib/widgets/window_buttons.dart +++ b/lib/widgets/window_buttons.dart @@ -6,6 +6,7 @@ import 'package:fluent_ui/fluent_ui.dart'; import 'package:bitsdojo_window/bitsdojo_window.dart'; import 'package:flutter_fullscreen/flutter_fullscreen.dart'; +import '../main.dart'; import '../utils/l10n.dart'; import '../utils/router/navigation.dart'; import '../utils/navigation/utils/escape_from_search.dart'; @@ -174,6 +175,14 @@ class _WindowFrameState extends State with FullScreenListener { onPressed: () async { appWindow.minimize(); }, + child: isWindows11 + ? null + : Center( + child: Icon( + FluentIcons.chrome_minimize, + size: 12, + ), + ), ), MouseRegion( onEnter: (event) async { @@ -188,12 +197,30 @@ class _WindowFrameState extends State with FullScreenListener { appWindow.maximizeOrRestore(); }); }, + child: isWindows11 + ? null + : Center( + child: Icon( + appWindow.isMaximized + ? FluentIcons.chrome_restore + : FluentIcons.square_shape, + size: 12, + ), + ), ), ), WindowIconButton( onPressed: () { appWindow.hide(); }, + child: isWindows11 + ? null + : Center( + child: Icon( + FluentIcons.chrome_close, + size: 12, + ), + ), ), appWindow.isMaximized ? SizedBox(width: 2) : SizedBox(width: 7), ],