appBar method

  1. @override
PreferredSizeWidget appBar(
  1. AppModel app,
  2. BuildContext context, {
  3. required AppbarHeaderAttributes headerAttributes,
  4. required MemberModel? member,
  5. required String pageName,
  6. List<AbstractMenuItemAttributes>? items,
  7. BackgroundModel? backgroundOverride,
  8. RgbModel? menuBackgroundColorOverride,
  9. RgbModel? selectedIconColorOverride,
  10. RgbModel? iconColorOverride,
  11. VoidCallback? openDrawer,
  12. 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)));
}