Skip to content

Commit

Permalink
fix: Fix #112
Browse files Browse the repository at this point in the history
  • Loading branch information
Losses committed Nov 25, 2024
1 parent 55a5f9c commit aa614a6
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ import 'theme.dart';

late bool disableBrandingAnimation;
late String? initialPath;
late bool isWindows11;

void main(List<String> arguments) async {
WidgetsFlutterBinding.ensureInitialized();
Expand All @@ -84,6 +85,7 @@ void main(List<String> 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;
Expand Down
27 changes: 27 additions & 0 deletions lib/widgets/window_buttons.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -174,6 +175,14 @@ class _WindowFrameState extends State<WindowFrame> with FullScreenListener {
onPressed: () async {
appWindow.minimize();
},
child: isWindows11
? null
: Center(
child: Icon(
FluentIcons.chrome_minimize,
size: 12,
),
),
),
MouseRegion(
onEnter: (event) async {
Expand All @@ -188,12 +197,30 @@ class _WindowFrameState extends State<WindowFrame> 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),
],
Expand Down

0 comments on commit aa614a6

Please sign in to comment.