You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
aku_new_community/lib/widget/bee_scaffold.dart

93 lines
2.3 KiB

3 years ago
import 'package:aku_new_community/constants/app_theme.dart';
import 'package:aku_new_community/widget/bee_back_button.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
class BeeScaffold extends StatelessWidget {
final dynamic title;
3 years ago
final Widget? body;
/// appbar background color
///
/// default Colors.white
final Color bgColor;
final Color bodyColor;
3 years ago
final List<Widget>? actions;
final Widget? leading;
final Widget? bottomNavi;
final PreferredSizeWidget? appBarBottom;
final FloatingActionButton? fab;
3 years ago
final double? titleSpacing;
final bool extendBody;
3 years ago
final SystemUiOverlayStyle systemStyle;
3 years ago
BeeScaffold({
3 years ago
Key? key,
this.title,
this.body,
this.actions,
this.leading,
this.bgColor = Colors.white,
this.bodyColor = const Color(0xFFF9F9F9),
this.bottomNavi,
this.appBarBottom,
this.fab,
3 years ago
this.titleSpacing,
this.systemStyle = SystemStyle.initial,
this.extendBody = false,
}) : super(key: key);
BeeScaffold.white({
3 years ago
Key? key,
required this.title,
this.body,
this.actions,
this.leading,
this.bgColor = Colors.white,
this.bottomNavi,
this.appBarBottom,
this.fab,
3 years ago
this.titleSpacing,
this.systemStyle = SystemStyle.initial,
this.extendBody = false,
}) : this.bodyColor = Colors.white,
super(key: key);
Widget? get _titleWidget {
if (title == null) return null;
if (title is String) return Text(title!);
if (title is Widget) return title as Widget;
return null;
}
@override
Widget build(BuildContext context) {
3 years ago
Widget? appBar;
if (title != null)
appBar = AppBar(
backgroundColor: extendBody ? Colors.transparent : bgColor,
title: _titleWidget,
leading: leading ?? BeeBackButton(),
actions: actions,
bottom: appBarBottom,
3 years ago
titleSpacing: titleSpacing,
3 years ago
);
return AnnotatedRegion<SystemUiOverlayStyle>(
value: systemStyle,
child: Scaffold(
backgroundColor: bodyColor,
3 years ago
appBar: appBar as PreferredSizeWidget?,
extendBodyBehindAppBar: extendBody,
extendBody: extendBody,
body: body,
bottomNavigationBar: bottomNavi,
floatingActionButton: fab,
),
);
}
}