toBottomNavigationBarItem method

BottomNavigationBarItem toBottomNavigationBarItem(
  1. BuildContext context,
  2. OudsNavigationBarControlState controlState, {
  3. required bool isSelected,
})

Creates a BottomNavigationBarItem for this OudsNavigationBarItem.

This is intended to be used by OudsTabBar, which is backed by Cupertino's CupertinoTabBar (iOS-style tab bar) and therefore expects a list of BottomNavigationBarItem.

  • context : BuildContext to access theme and layout.
  • controlState to drive icon/top-indicator colors,
  • isSelected for the destination selection state.

Implementation

BottomNavigationBarItem toBottomNavigationBarItem(
  BuildContext context,
  OudsNavigationBarControlState controlState, {
  required bool isSelected,
}) {
  final modifier = OudsNavigationBarStatusModifier(context);

  return BottomNavigationBarItem(
    label: label,
    icon: _buildBadgeIconBottomNavigationBarItem(
      context,
      icon,
      modifier,
      controlState,
      badge,
      isSelected: isSelected,
    ),
    activeIcon: _buildBadgeIconBottomNavigationBarItem(
      context,
      icon,
      modifier,
      controlState,
      badge,
      isSelected: isSelected,
    ),
  );
}