KeyedBottomNavigationBar<T> constructor
KeyedBottomNavigationBar<T> ({
- Key? key,
- required Map<
T, BottomNavigationBarItem> items, - List<
T> ? keyOrder, - ValueChanged<
T> ? onTap, - required T currentItemKey,
- 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,
Constructs the bar.
If keyOrder
is non-null, only the given keys will be picked
from the items
map.
Implementation
KeyedBottomNavigationBar({
super.key,
required Map<T, BottomNavigationBarItem> items,
List<T>? keyOrder,
ValueChanged<T>? onTap,
required T currentItemKey,
super.elevation,
super.type,
super.fixedColor,
super.backgroundColor,
super.iconSize,
super.selectedItemColor,
super.unselectedItemColor,
super.selectedIconTheme,
super.unselectedIconTheme,
super.selectedFontSize,
super.unselectedFontSize,
super.selectedLabelStyle,
super.unselectedLabelStyle,
super.showSelectedLabels,
super.showUnselectedLabels,
super.mouseCursor,
super.enableFeedback,
super.landscapeLayout,
}) : super(
items: keyOrder == null
? items.values.toList(growable: false)
: keyOrder.map((key) => items[key]!).toList(growable: false),
currentIndex: max(
(keyOrder ?? items.keys.toList(growable: false))
.indexOf(currentItemKey),
0,
),
onTap: (index) => onTap
?.call((keyOrder ?? items.keys.toList(growable: false))[index]),
);