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'),
);
Methods
-
Available on List<
Creates a BottomNavigationBar widget using this list as the items.BottomNavigationBarItem> , provided by the BottomNavigationBarExtensions extension