Solian/lib/widgets/scaffold.dart

46 lines
1.2 KiB
Dart
Raw Normal View History

2024-04-12 16:38:20 +00:00
import 'package:flutter/material.dart';
import 'package:solian/utils/theme.dart';
2024-04-12 16:38:20 +00:00
import 'package:solian/widgets/navigation_drawer.dart';
class IndentScaffold extends StatelessWidget {
2024-04-12 16:38:20 +00:00
final Widget? child;
2024-04-16 12:36:47 +00:00
final Widget? floatingActionButton;
final Widget? appBarLeading;
2024-04-16 12:36:47 +00:00
final List<Widget>? appBarActions;
2024-04-30 12:31:54 +00:00
final bool noSafeArea;
final bool hideDrawer;
final bool fixedAppBarColor;
final String title;
2024-04-12 16:38:20 +00:00
const IndentScaffold({
2024-04-16 12:36:47 +00:00
super.key,
this.child,
required this.title,
this.floatingActionButton,
this.appBarLeading,
2024-04-16 12:36:47 +00:00
this.appBarActions,
this.hideDrawer = false,
this.fixedAppBarColor = false,
2024-04-30 12:31:54 +00:00
this.noSafeArea = false,
2024-04-16 12:36:47 +00:00
});
2024-04-12 16:38:20 +00:00
@override
Widget build(BuildContext context) {
2024-04-16 12:36:47 +00:00
final content = child ?? Container();
2024-04-12 16:38:20 +00:00
return Scaffold(
2024-05-01 16:49:38 +00:00
appBar: AppBar(
title: Text(title),
leading: appBarLeading,
2024-05-01 16:49:38 +00:00
actions: appBarActions,
centerTitle: false,
elevation: fixedAppBarColor ? 4 : null,
2024-05-01 16:49:38 +00:00
),
2024-04-16 12:36:47 +00:00
floatingActionButton: floatingActionButton,
drawer: !hideDrawer ? const SolianNavigationDrawer() : null,
drawerScrimColor: SolianTheme.isLargeScreen(context) ? Colors.transparent : null,
2024-04-30 12:31:54 +00:00
body: noSafeArea ? content : SafeArea(child: content),
2024-04-12 16:38:20 +00:00
);
}
}