bottomNavigationBar method

  1. @override
Widget bottomNavigationBar(
  1. AppModel app,
  2. BuildContext context, {
  3. required MemberModel? member,
  4. BackgroundModel? backgroundOverride,
  5. RgbModel? popupMenuBackgroundColorOverride,
  6. required List<AbstractMenuItemAttributes> items,
  7. Key? key,
})
override

Implementation

@override
Widget bottomNavigationBar(
  AppModel app,
  BuildContext context, {
  required MemberModel? member,
  BackgroundModel? backgroundOverride,
  RgbModel? popupMenuBackgroundColorOverride,
  required List<AbstractMenuItemAttributes> items,
  Key? key,
}) {
  var background = backgroundOverride ??=
      _monaStyle.monaStyleAttributesModel.bottomNavigationBarBG;
  var selectedRgbColor = _monaStyle.monaStyleAttributesModel.h3!.color;
  var selectedColor = selectedRgbColor == null
      ? Colors.black
      : RgbHelper.color(rgbo: selectedRgbColor);

  var rgbColor = _monaStyle.monaStyleAttributesModel.h4!.color;
  var color =
      rgbColor == null ? Colors.black : RgbHelper.color(rgbo: rgbColor);

  int? selected; // must have 1 selected
  for (int i = 0; i < items.length; i++) {
    if (items[i].isActive) {
      selected = i;
      break;
    }
  }
  return 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),
      child: Theme(
          data: Theme.of(context).copyWith(
              textTheme: Theme.of(context).textTheme.copyWith(
                    bodyMedium: FontTools.textStyle(
                        _monaStyle.monaStyleAttributesModel.h4),
                  )), // sets the inactive color of the `BottomNavigationBar`
          child: BottomNavigationBar(
              key: key,
              elevation: 0,
              selectedFontSize: 16,
              unselectedFontSize: 14,
              type: BottomNavigationBarType.fixed,
              backgroundColor: Colors.transparent,
              onTap: (item) {
                var theItem = items[item];
                if (theItem is MenuItemAttributes) {
                  theItem.onTap();
                } else if (theItem is MenuItemWithMenuItems) {
                  _monaStyle.frontEndStyle().menuStyle().openMenu(
                      app, context,
                      position:
                          RelativeRect.fromLTRB(1000.0, 1000.0, 0.0, 0.0),
                      menuItems: theItem.items,
                      popupMenuBackgroundColorOverride:
                          popupMenuBackgroundColorOverride);
                }
              },
              currentIndex: selected ?? 0,
              fixedColor: selected == null ? color : selectedColor,
              unselectedItemColor: color,
              items: items.map((item) {
                return BottomNavigationBarItem(
                  label: item.label,
                  icon: getIconExcl(app, context, item),
                );
              }).toList())));
}