From b2a2d38c3d3e48225cc89cfc878e9ee0e1af7ca1 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Sun, 7 Jul 2024 02:45:13 +0800 Subject: [PATCH] :lipstick: Better macos window --- lib/main.dart | 3 -- lib/shells/root_shell.dart | 69 +++++++++++++++++----------- macos/Runner/Base.lproj/MainMenu.xib | 10 ++-- 3 files changed, 48 insertions(+), 34 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index 39dacba..c63d00d 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -59,9 +59,6 @@ Future _initializePlatformComponents() async { if (PlatformInfo.isMacOS) { await Future.wait([ Window.hideTitle(), - Window.hideCloseButton(), - Window.hideMiniaturizeButton(), - Window.hideZoomButton(), Window.makeTitlebarTransparent(), Window.enableFullSizeContentView(), ]); diff --git a/lib/shells/root_shell.dart b/lib/shells/root_shell.dart index f5f9c94..d10de6f 100644 --- a/lib/shells/root_shell.dart +++ b/lib/shells/root_shell.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_animate/flutter_animate.dart'; import 'package:go_router/go_router.dart'; +import 'package:solian/platform.dart'; import 'package:solian/router.dart'; import 'package:solian/theme.dart'; import 'package:solian/widgets/navigation/app_navigation.dart'; @@ -31,33 +32,49 @@ class RootShell extends StatelessWidget { AppNavigation.destinationPages.contains(routeName); return Scaffold( - body: SolianTheme.isLargeScreen(context) - ? Row( - children: [ - if (showNavigation) const AppNavigationRail(), - if (showNavigation) - const VerticalDivider(thickness: 0.3, width: 1), - Expanded(child: child), - ], - ) - : Stack( - children: [ - child, - Positioned( - bottom: 0, - left: 0, - right: 0, - child: const AppNavigationBottomBar() - .animate(target: showBottom ? 0 : 1) - .slideY( - duration: 250.ms, - begin: 0, - end: 1, - curve: Curves.easeInToLinear, - ), - ), - ], + body: Column( + children: [ + if (PlatformInfo.isMacOS) + Container( + height: 28, + color: Theme.of(context).colorScheme.surface, ), + if (PlatformInfo.isMacOS) + const Divider( + thickness: 0.3, + height: 0.3, + ), + Expanded( + child: SolianTheme.isLargeScreen(context) + ? Row( + children: [ + if (showNavigation) const AppNavigationRail(), + if (showNavigation) + const VerticalDivider(thickness: 0.3, width: 1), + Expanded(child: child), + ], + ) + : Stack( + children: [ + child, + Positioned( + bottom: 0, + left: 0, + right: 0, + child: const AppNavigationBottomBar() + .animate(target: showBottom ? 0 : 1) + .slideY( + duration: 250.ms, + begin: 0, + end: 1, + curve: Curves.easeInToLinear, + ), + ), + ], + ), + ), + ], + ), ); } } diff --git a/macos/Runner/Base.lproj/MainMenu.xib b/macos/Runner/Base.lproj/MainMenu.xib index 70bc316..d38b511 100644 --- a/macos/Runner/Base.lproj/MainMenu.xib +++ b/macos/Runner/Base.lproj/MainMenu.xib @@ -330,16 +330,16 @@ - - - + + + - + - +