BottomTabBar constructor

BottomTabBar({
  1. Key? key,
  2. @required List<BottomTabBarItem>? items,
  3. ValueChanged<int>? onTap,
  4. int? currentIndex = 0,
  5. BottomTabBarType? type,
  6. Color? fixedColor,
  7. double? iconSize = 24.0,
  8. bool? isAnimation = true,
  9. Color? badgeColor,
  10. Color? bgColor,
  11. Color? textColor,
  12. 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);