Solian/lib/widgets/indent_wrapper.dart

38 lines
995 B
Dart
Raw Normal View History

2024-04-14 07:58:27 +00:00
import 'package:flutter/material.dart';
2024-04-30 12:31:54 +00:00
import 'package:solian/router.dart';
2024-04-16 12:36:47 +00:00
import 'package:solian/widgets/common_wrapper.dart';
2024-04-14 07:58:27 +00:00
import 'package:solian/widgets/navigation_drawer.dart';
2024-04-16 12:36:47 +00:00
class IndentWrapper extends LayoutWrapper {
2024-04-30 12:31:54 +00:00
final bool hideDrawer;
2024-04-14 07:58:27 +00:00
2024-04-16 12:36:47 +00:00
const IndentWrapper({
super.key,
super.child,
required super.title,
super.floatingActionButton,
super.appBarActions,
2024-04-30 12:31:54 +00:00
this.hideDrawer = false,
super.noSafeArea = false,
2024-04-16 12:36:47 +00:00
}) : super();
2024-04-14 07:58:27 +00:00
@override
Widget build(BuildContext context) {
final content = child ?? Container();
return Scaffold(
2024-04-30 12:31:54 +00:00
appBar: AppBar(
leading: hideDrawer ? IconButton(
icon: const Icon(Icons.arrow_back),
onPressed: () => router.pop(),
) : null,
title: Text(title),
actions: appBarActions,
),
2024-04-14 07:58:27 +00:00
floatingActionButton: floatingActionButton,
2024-04-30 12:31:54 +00:00
drawer: const SolianNavigationDrawer(),
body: noSafeArea ? content : SafeArea(child: content),
2024-04-14 07:58:27 +00:00
);
}
}