show method
BottomNavigationBar?
show({
- List<
BottomNavigationBarItem> ? items, - ValueChanged<
int> ? onTap, - int? currentIndex,
- double? elevation,
- BottomNavigationBarType? type,
- Color? fixedColor,
- Color? backgroundColor,
- double? iconSize,
- Color? selectedItemColor,
- Color? unselectedItemColor,
- IconThemeData? selectedIconTheme,
- IconThemeData? unselectedIconTheme,
- double? selectedFontSize,
- double? unselectedFontSize,
- TextStyle? selectedLabelStyle,
- TextStyle? unselectedLabelStyle,
- bool? showSelectedLabels,
- bool? showUnselectedLabels,
- bool? hide,
Display the defined BottomNavigationBar
Implementation
BottomNavigationBar? show(
{List<BottomNavigationBarItem>? items,
ValueChanged<int>? onTap,
int? currentIndex,
double? elevation,
BottomNavigationBarType? type,
Color? fixedColor,
Color? backgroundColor,
double? iconSize,
Color? selectedItemColor,
Color? unselectedItemColor,
IconThemeData? selectedIconTheme,
IconThemeData? unselectedIconTheme,
double? selectedFontSize,
double? unselectedFontSize,
TextStyle? selectedLabelStyle,
TextStyle? unselectedLabelStyle,
bool? showSelectedLabels,
bool? showUnselectedLabels,
bool? hide}) {
// In case null was directly assigned.
this.hide ??= false;
hide ??= this.hide;
if (hide!) {
return null;
}
// If directly assigned an invalid index
currentIndex ??= this.currentIndex;
if (currentIndex == null || currentIndex < 0) {
currentIndex = _lastIndex;
}
if (items != null && currentIndex > items.length - 1) {
currentIndex = _lastIndex;
}
// Supply the original routine if any.
onTap ??= this.onTap;
return BottomNavigationBar(
key: key,
items: items ?? this.items!,
onTap: (int index) {
this.currentIndex = index;
_lastIndex = index;
if (onTap != null) {
onTap(index);
}
},
currentIndex: currentIndex,
elevation: elevation ?? this.elevation ?? 8.0,
type: type ?? this.type,
fixedColor: fixedColor ?? this.fixedColor,
backgroundColor: backgroundColor ?? this.backgroundColor,
iconSize: iconSize ?? this.iconSize ?? 24.0,
selectedItemColor: selectedItemColor ?? this.selectedItemColor,
unselectedItemColor: unselectedItemColor ?? this.unselectedItemColor,
selectedIconTheme:
selectedIconTheme ?? this.selectedIconTheme ?? const IconThemeData(),
unselectedIconTheme: unselectedIconTheme ??
this.unselectedIconTheme ??
const IconThemeData(),
selectedFontSize: selectedFontSize ?? this.selectedFontSize ?? 14.0,
unselectedFontSize: unselectedFontSize ?? this.unselectedFontSize ?? 12.0,
selectedLabelStyle: selectedLabelStyle ?? this.selectedLabelStyle,
unselectedLabelStyle: unselectedLabelStyle ?? this.unselectedLabelStyle,
showSelectedLabels: showSelectedLabels ?? this.showSelectedLabels ?? true,
showUnselectedLabels: showUnselectedLabels ?? this.showUnselectedLabels,
);
}