BottomTabBar constructor
BottomTabBar({
- Key? key,
- @required List<
BottomTabBarItem> ? items, - ValueChanged<
int> ? onTap, - int? currentIndex = 0,
- BottomTabBarType? type,
- Color? fixedColor,
- double? iconSize = 24.0,
- bool? isAnimation = true,
- Color? badgeColor,
- Color? bgColor,
- Color? textColor,
- bool? isInkResponse = true,
Creates a bottom navigation bar, typically used in a Scaffold where it
is provided as the Scaffold.BottomTabBar
argument.
The length of items must be at least two and each item's icon and title must be not null.
If type
is null then BottomTabBarType.fixed is used when there
are two or three items, BottomTabBarType.shifting otherwise.
If fixedColor is null then the theme's primary color,
ThemeData.primaryColor, is used. However if BottomTabBar.type
is
BottomTabBarType.shifting then fixedColor is ignored.
Implementation
BottomTabBar({
Key? key,
@required this.items,
this.onTap,
this.currentIndex = 0,
BottomTabBarType? type,
this.fixedColor,
this.iconSize = 24.0,
this.isAnimation = true,
this.badgeColor,
this.bgColor,
this.textColor,
this.isInkResponse = true,
}) : assert(items != null),
assert(items!.length >= 2),
assert(
items!.every((BottomTabBarItem item) => item.title != null) == true,
'Every item must have a non-null title',
),
assert(0 <= currentIndex! && currentIndex < items!.length),
assert(iconSize != null),
type = type ?? (items!.length <= 3 ? BottomTabBarType.fixed : BottomTabBarType.shifting),
super(key: key);