xBottomNavigationBar method
Defines the appearance of the button items that are arrayed within the bottom navigation bar.
Implementation
Widget xBottomNavigationBar({
/// Called when one of the [items] is tapped.
///
/// The stateful widget that creates the bottom navigation bar needs to keep
/// track of the index of the selected [BottomNavigationBarItem] and call
/// `setState` to rebuild the bottom navigation bar with the new [currentIndex].
ValueChanged<int> onTap,
/// The index into [items] for the current active [BottomNavigationBarItem].
int currentIndex = 0,
/// The z-coordinate of this [BottomNavigationBar].
///
/// If null, defaults to `8.0`.
///
/// {@macro flutter.material.material.elevation}
double elevation = 8.0,
/// Defines the layout and behavior of a [BottomNavigationBar].
///
/// See documentation for [BottomNavigationBarType] for information on the
/// meaning of different types.
BottomNavigationBarType type,
/// The color of the [BottomNavigationBar] itself.
///
/// If [type] is [BottomNavigationBarType.shifting] and the
/// [items]s, have [BottomNavigationBarItem.backgroundColor] set, the [item]'s
/// backgroundColor will splash and overwrite this color.
Color backgroundColor,
/// The size of all of the [BottomNavigationBarItem] icons.
///
/// See [BottomNavigationBarItem.icon] for more information.
double iconSize = 24.0,
/// The color of the selected [BottomNavigationBarItem.icon] and
/// [BottomNavigationBarItem.label].
///
/// If null then the [ThemeData.primaryColor] is used.
Color selectedItemColor,
/// The color of the unselected [BottomNavigationBarItem.icon] and
/// [BottomNavigationBarItem.label]s.
///
/// If null then the [TextTheme.caption]'s color is used.
Color unselectedItemColor,
/// The size, opacity, and color of the icon in the currently selected
/// [BottomNavigationBarItem.icon].
///
/// If this is not provided, the size will default to [iconSize], the color
/// will default to [selectedItemColor].
///
/// It this field is provided, it must contain non-null [IconThemeData.size]
/// and [IconThemeData.color] properties. Also, if this field is supplied,
/// [unselectedIconTheme] must be provided.
IconThemeData selectedIconTheme = const IconThemeData(),
/// The size, opacity, and color of the icon in the currently unselected
/// [BottomNavigationBarItem.icon]s
///
/// If this is not provided, the size will default to [iconSize], the color
/// will default to [unselectedItemColor].
///
/// It this field is provided, it must contain non-null [IconThemeData.size]
/// and [IconThemeData.color] properties. Also, if this field is supplied,
/// [unselectedIconTheme] must be provided.
IconThemeData unselectedIconTheme = const IconThemeData(),
/// The [TextStyle] of the [BottomNavigationBarItem] labels when they are
/// selected.
TextStyle selectedLabelStyle,
/// The [TextStyle] of the [BottomNavigationBarItem] labels when they are not
/// selected.
TextStyle unselectedLabelStyle,
/// The font size of the [BottomNavigationBarItem] labels when they are selected.
///
/// If [selectedLabelStyle.fontSize] is non-null, it will be used instead of this.
///
/// Defaults to `14.0`.
double selectedFontSize = 14.0,
/// The font size of the [BottomNavigationBarItem] labels when they are not
/// selected.
///
/// If [unselectedLabelStyle.fontSize] is non-null, it will be used instead of this.
///
/// Defaults to `12.0`.
double unselectedFontSize = 12.0,
/// Whether the labels are shown for the selected [BottomNavigationBarItem].
bool showUnselectedLabels,
/// Whether the labels are shown for the unselected [BottomNavigationBarItem]s.
bool showSelectedLabels = true,
Color fixedColor,
Key key,
}) {
return BottomNavigationBar(
items: this,
backgroundColor: backgroundColor,
currentIndex: currentIndex,
elevation: elevation,
fixedColor: fixedColor,
iconSize: iconSize,
key: key,
onTap: onTap,
selectedFontSize: selectedFontSize,
selectedIconTheme: selectedIconTheme,
selectedItemColor: selectedItemColor,
selectedLabelStyle: selectedLabelStyle,
showSelectedLabels: showSelectedLabels,
showUnselectedLabels: showUnselectedLabels,
type: type,
unselectedFontSize: unselectedFontSize,
unselectedIconTheme: unselectedIconTheme,
unselectedItemColor: unselectedItemColor,
unselectedLabelStyle: unselectedLabelStyle,
);
}