appBar method
PreferredSizeWidget
appBar(
- AppModel app,
- BuildContext context, {
- required AppbarHeaderAttributes headerAttributes,
- required MemberModel? member,
- required String pageName,
- List<
AbstractMenuItemAttributes> ? items, - BackgroundModel? backgroundOverride,
- RgbModel? selectedIconColorOverride,
- RgbModel? iconColorOverride,
- VoidCallback? openDrawer,
- Key? key,
override
Implementation
@override
PreferredSizeWidget appBar(AppModel app, BuildContext context,
{required AppbarHeaderAttributes headerAttributes,
required MemberModel? member,
required String pageName,
List<AbstractMenuItemAttributes>? items,
BackgroundModel? backgroundOverride,
RgbModel? menuBackgroundColorOverride,
RgbModel? selectedIconColorOverride,
RgbModel? iconColorOverride,
VoidCallback? openDrawer,
Key? key}) {
var background =
backgroundOverride ?? _monaStyle.monaStyleAttributesModel.appBarBG;
var iconColor = iconColorOverride ??
_monaStyle.monaStyleAttributesModel.appBarIconColor;
var selectedIconColor = selectedIconColorOverride ??
_monaStyle.monaStyleAttributesModel.appBarSelectedIconColor;
var menuBackgroundColor = menuBackgroundColorOverride ??
_monaStyle.monaStyleAttributesModel.appBarMenuBackgroundColor;
var appBarHelper =
AppBarHelper(_monaStyle.frontEndStyle(), MonaMenuImpl(_monaStyle));
var title = appBarHelper.title(app, context, headerAttributes, pageName);
var iconThemeData = IconThemeData(color: RgbHelper.color(rgbo: iconColor));
// add menu items
List<Widget>? buttons;
if (items != null) {
buttons = items
.map((item) => appBarHelper.button(app, context, item,
menuBackgroundColor, selectedIconColor, iconColor))
.toList();
} else {
buttons = [];
}
// add profilePhoto
if (member != null) {
buttons.add(_monaStyle
.frontEndStyle()
.profilePhotoStyle()
.getProfilePhotoButtonFromMember(app, context,
member: member,
radius: 20,
iconColor: EliudColors.white,
onPressed: openDrawer));
}
return AppBar(
// elevation: 30.0,
key: key,
iconTheme: iconThemeData,
title: title,
actions: buttons,
flexibleSpace: Container(
clipBehavior: BoxDecorationHelper.determineClipBehaviour(
app, member, background),
margin:
BoxDecorationHelper.determineMargin(app, member, background),
padding:
BoxDecorationHelper.determinePadding(app, member, background),
decoration:
BoxDecorationHelper.boxDecoration(app, member, background)));
}