🐛 Fix window decoration on macOS
This commit is contained in:
parent
9f4185dff6
commit
0afb6b9c5b
@ -23,6 +23,7 @@ class AppPageScaffold extends StatelessWidget {
|
|||||||
final Widget? body;
|
final Widget? body;
|
||||||
final bool showAppBar;
|
final bool showAppBar;
|
||||||
final bool showBottomNavigation;
|
final bool showBottomNavigation;
|
||||||
|
|
||||||
const AppPageScaffold({
|
const AppPageScaffold({
|
||||||
super.key,
|
super.key,
|
||||||
this.title,
|
this.title,
|
||||||
@ -34,11 +35,9 @@ class AppPageScaffold extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final state = GoRouter.maybeOf(context);
|
final state = GoRouter.maybeOf(context);
|
||||||
final routeName =
|
final routeName = state?.routerDelegate.currentConfiguration.last.route.name;
|
||||||
state?.routerDelegate.currentConfiguration.last.route.name;
|
|
||||||
|
|
||||||
final autoTitle =
|
final autoTitle = state != null ? 'screen${routeName?.capitalize()}' : 'screen';
|
||||||
state != null ? 'screen${routeName?.capitalize()}' : 'screen';
|
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: showAppBar
|
appBar: showAppBar
|
||||||
@ -53,29 +52,21 @@ class AppPageScaffold extends StatelessWidget {
|
|||||||
|
|
||||||
class AppRootScaffold extends StatelessWidget {
|
class AppRootScaffold extends StatelessWidget {
|
||||||
final Widget body;
|
final Widget body;
|
||||||
|
|
||||||
const AppRootScaffold({super.key, required this.body});
|
const AppRootScaffold({super.key, required this.body});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final devicePixelRatio = MediaQuery.of(context).devicePixelRatio;
|
final devicePixelRatio = MediaQuery.of(context).devicePixelRatio;
|
||||||
|
|
||||||
final isCollapseDrawer =
|
final isCollapseDrawer = ResponsiveBreakpoints.of(context).smallerOrEqualTo(MOBILE);
|
||||||
ResponsiveBreakpoints.of(context).smallerOrEqualTo(MOBILE);
|
|
||||||
final isExpandDrawer = ResponsiveBreakpoints.of(context).largerThan(TABLET);
|
final isExpandDrawer = ResponsiveBreakpoints.of(context).largerThan(TABLET);
|
||||||
|
|
||||||
final routeName = GoRouter.of(context)
|
final routeName = GoRouter.of(context).routerDelegate.currentConfiguration.last.route.name;
|
||||||
.routerDelegate
|
final isShowBottomNavigation = NavigationProvider.kShowBottomNavScreen.contains(routeName)
|
||||||
.currentConfiguration
|
|
||||||
.last
|
|
||||||
.route
|
|
||||||
.name;
|
|
||||||
final isShowBottomNavigation =
|
|
||||||
NavigationProvider.kShowBottomNavScreen.contains(routeName)
|
|
||||||
? ResponsiveBreakpoints.of(context).smallerOrEqualTo(MOBILE)
|
? ResponsiveBreakpoints.of(context).smallerOrEqualTo(MOBILE)
|
||||||
: false;
|
: false;
|
||||||
final isPopable = !NavigationProvider.kAllDestination
|
final isPopable = !NavigationProvider.kAllDestination.map((ele) => ele.screen).contains(routeName);
|
||||||
.map((ele) => ele.screen)
|
|
||||||
.contains(routeName);
|
|
||||||
|
|
||||||
final innerWidget = isCollapseDrawer
|
final innerWidget = isCollapseDrawer
|
||||||
? body
|
? body
|
||||||
@ -90,9 +81,7 @@ class AppRootScaffold extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: isExpandDrawer
|
child: isExpandDrawer ? AppNavigationDrawer(elevation: 0) : AppRailNavigation(),
|
||||||
? AppNavigationDrawer(elevation: 0)
|
|
||||||
: AppRailNavigation(),
|
|
||||||
),
|
),
|
||||||
Expanded(child: body),
|
Expanded(child: body),
|
||||||
],
|
],
|
||||||
@ -112,13 +101,19 @@ class AppRootScaffold extends StatelessWidget {
|
|||||||
key: globalRootScaffoldKey,
|
key: globalRootScaffoldKey,
|
||||||
body: Column(
|
body: Column(
|
||||||
children: [
|
children: [
|
||||||
if (!kIsWeb &&
|
if (!kIsWeb && (Platform.isWindows || Platform.isLinux || Platform.isMacOS))
|
||||||
(Platform.isWindows || Platform.isLinux || Platform.isMacOS))
|
Container(
|
||||||
WindowBorder(
|
decoration: BoxDecoration(
|
||||||
|
border: Border(
|
||||||
|
bottom: BorderSide(
|
||||||
color: Theme.of(context).dividerColor,
|
color: Theme.of(context).dividerColor,
|
||||||
width: 1,
|
width: 1 / devicePixelRatio,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
mainAxisAlignment: Platform.isMacOS ? MainAxisAlignment.center : MainAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
WindowTitleBarBox(
|
WindowTitleBarBox(
|
||||||
child: MoveWindow(
|
child: MoveWindow(
|
||||||
@ -128,6 +123,7 @@ class AppRootScaffold extends StatelessWidget {
|
|||||||
).padding(horizontal: 12, vertical: 5),
|
).padding(horizontal: 12, vertical: 5),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
if (!Platform.isMacOS)
|
||||||
Expanded(
|
Expanded(
|
||||||
child: WindowTitleBarBox(
|
child: WindowTitleBarBox(
|
||||||
child: Row(
|
child: Row(
|
||||||
@ -153,8 +149,7 @@ class AppRootScaffold extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
drawer: !isExpandDrawer ? AppNavigationDrawer() : null,
|
drawer: !isExpandDrawer ? AppNavigationDrawer() : null,
|
||||||
drawerEdgeDragWidth: isPopable ? 0 : null,
|
drawerEdgeDragWidth: isPopable ? 0 : null,
|
||||||
bottomNavigationBar:
|
bottomNavigationBar: isShowBottomNavigation ? AppBottomNavigationBar() : null,
|
||||||
isShowBottomNavigation ? AppBottomNavigationBar() : null,
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user