BottomNavigationBarExtensions extension

Extension on List<BottomNavigationBarItem> that provides convenient methods for creating BottomNavigationBar widgets.

This extension simplifies the creation of bottom navigation bars by allowing direct method calls on a list of navigation bar items, reducing boilerplate code and improving readability.

Example usage:

final items = [
  BottomNavigationBarItem(icon: Icon(Icons.home), label: 'Home'),
  BottomNavigationBarItem(icon: Icon(Icons.search), label: 'Search'),
];

final bottomBar = items.bottomNavigationBar(
  currentIndex: 0,
  onTap: (index) => print('Tapped item $index'),
);
on

Methods

bottomNavigationBar({void onTap(int)?, int currentIndex = 0, double? elevation, BottomNavigationBarType? type, Color? fixedColor, Color? backgroundColor, double iconSize = 24.0, Color? selectedItemColor, Color? unselectedItemColor, IconThemeData? selectedIconTheme, IconThemeData? unselectedIconTheme, double selectedFontSize = 14.0, double unselectedFontSize = 12.0, TextStyle? selectedLabelStyle, TextStyle? unselectedLabelStyle, bool? showSelectedLabels, bool? showUnselectedLabels, MouseCursor? mouseCursor, bool? enableFeedback, BottomNavigationBarLandscapeLayout? landscapeLayout, bool useLegacyColorScheme = true}) BottomNavigationBar

Available on List<BottomNavigationBarItem>, provided by the BottomNavigationBarExtensions extension

Creates a BottomNavigationBar widget using this list as the items.