Solian/lib/widgets/common_wrapper.dart

32 lines
815 B
Dart
Raw Normal View History

2024-04-12 16:38:20 +00:00
import 'package:flutter/material.dart';
import 'package:solian/widgets/navigation_drawer.dart';
class LayoutWrapper extends StatelessWidget {
final Widget? child;
2024-04-16 12:36:47 +00:00
final Widget? floatingActionButton;
final List<Widget>? appBarActions;
final bool? noSafeArea;
final String title;
2024-04-12 16:38:20 +00:00
2024-04-16 12:36:47 +00:00
const LayoutWrapper({
super.key,
this.child,
required this.title,
this.floatingActionButton,
this.appBarActions,
this.noSafeArea,
});
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-04-16 12:36:47 +00:00
appBar: AppBar(title: Text(title), actions: appBarActions),
floatingActionButton: floatingActionButton,
2024-04-12 16:38:20 +00:00
drawer: const SolianNavigationDrawer(),
2024-04-16 12:36:47 +00:00
body: (noSafeArea ?? false) ? content : SafeArea(child: content),
2024-04-12 16:38:20 +00:00
);
}
}