diff --git a/lib/main.dart b/lib/main.dart index c63d00d..eaab99d 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -19,6 +19,7 @@ import 'package:solian/providers/content/realm.dart'; import 'package:solian/providers/friend.dart'; import 'package:solian/providers/account_status.dart'; import 'package:solian/router.dart'; +import 'package:solian/shells/system_shell.dart'; import 'package:solian/theme.dart'; import 'package:solian/translations.dart'; @@ -85,8 +86,10 @@ class SolianApp extends StatelessWidget { fallbackLocale: const Locale('en', 'US'), onInit: () => _initializeProviders(context), builder: (context, child) { - return ScaffoldMessenger( - child: child ?? const SizedBox(), + return SystemShell( + child: ScaffoldMessenger( + child: child ?? const SizedBox(), + ), ); }, ); diff --git a/lib/shells/root_shell.dart b/lib/shells/root_shell.dart index d10de6f..f5f9c94 100644 --- a/lib/shells/root_shell.dart +++ b/lib/shells/root_shell.dart @@ -1,7 +1,6 @@ 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'; @@ -32,49 +31,33 @@ class RootShell extends StatelessWidget { AppNavigation.destinationPages.contains(routeName); return Scaffold( - 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, - ), + 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, ), - ], - ), - ), - ], - ), + ), + ], + ), ); } } diff --git a/lib/shells/system_shell.dart b/lib/shells/system_shell.dart new file mode 100644 index 0000000..384957a --- /dev/null +++ b/lib/shells/system_shell.dart @@ -0,0 +1,29 @@ +import 'package:flutter/material.dart'; +import 'package:solian/platform.dart'; + +class SystemShell extends StatelessWidget { + final Widget child; + + const SystemShell({super.key, required this.child}); + + @override + Widget build(BuildContext context) { + if (PlatformInfo.isMacOS) { + return Column( + children: [ + Container( + height: 28, + color: Theme.of(context).colorScheme.surface, + ), + const Divider( + thickness: 0.3, + height: 0.3, + ), + Expanded(child: child), + ], + ); + } + + return child; + } +}