Solian/lib/shells/root_shell.dart

44 lines
1.2 KiB
Dart
Raw Normal View History

2024-07-06 12:55:53 +00:00
import 'package:flutter/material.dart';
import 'package:solian/theme.dart';
2024-07-12 03:39:44 +00:00
import 'package:solian/widgets/navigation/app_navigation_drawer.dart';
2024-07-06 12:55:53 +00:00
import 'package:solian/widgets/navigation/app_navigation_rail.dart';
2024-07-12 03:39:44 +00:00
final GlobalKey<ScaffoldState> rootScaffoldKey = GlobalKey<ScaffoldState>();
2024-07-06 12:55:53 +00:00
class RootShell extends StatelessWidget {
final bool showSidebar;
final bool showNavigation;
final bool? showBottomNavigation;
final Widget child;
const RootShell({
super.key,
required this.child,
this.showSidebar = true,
this.showNavigation = true,
this.showBottomNavigation,
});
2024-07-12 03:39:44 +00:00
void closeDrawer() {
rootScaffoldKey.currentState!.closeDrawer();
}
2024-07-06 12:55:53 +00:00
@override
Widget build(BuildContext context) {
return Scaffold(
2024-07-12 03:39:44 +00:00
key: rootScaffoldKey,
drawer: const AppNavigationDrawer(),
body: SolianTheme.isLargeScreen(context)
? Row(
children: [
if (showNavigation) const AppNavigationRail(),
if (showNavigation)
const VerticalDivider(thickness: 0.3, width: 1),
Expanded(child: child),
],
)
2024-07-12 03:39:44 +00:00
: child,
2024-07-06 12:55:53 +00:00
);
}
}