SpotlightBottomNavigationBar constructor

SpotlightBottomNavigationBar({
  1. Key? key,
  2. required List<SpotlightBottomNavigationBarItem> items,
  3. ValueChanged<int>? onTap,
  4. required int currentIndex,
  5. bool darkTheme = true,
  6. Color unselectedItemColor = const Color(0xff666666),
  7. Color selectedItemColor = const Color(0xffffffff),
  8. Color backgroundColor = const Color(0xff101010),
  9. double iconSize = 24.0,
  10. IconThemeData? unselectedIconTheme,
  11. IconThemeData? selectedIconTheme,
  12. Gradient? spotlightGradient,
})

Creates a spotlight bottom navigation bar which can be used with Scaffold's Scaffold.bottomNavigationBar argument.

The length of items should be at least 2 and each item's icon property must not be null.

The selectedItemColor, unselectedItemColor and backgroundColor must not be null.

The iconSize must be non-null and non-negative.

If custom IconThemeData are used then it will override the selectedItemColor and unselectedItemColor, and the custom IconThemeData must have a non-null IconThemeData.color and IconThemeData.size.

The selectedItemColor will be used for the Top Bar highlighting the active item regardless of selectedIconTheme.color.

The spotlightGradient parameter can be used to give a custom Gradient for the spotlight.

Implementation

SpotlightBottomNavigationBar({
  Key? key,
  required this.items,
  this.onTap,
  required this.currentIndex,
  this.darkTheme = true,
  this.unselectedItemColor = const Color(0xff666666),
  this.selectedItemColor = const Color(0xffffffff),
  this.backgroundColor = const Color(0xff101010),
  this.iconSize = 24.0,
  this.unselectedIconTheme,
  this.selectedIconTheme,
  this.spotlightGradient,
})  : assert(items.length >= 2),
      assert(0 <= currentIndex && currentIndex < items.length),
      assert(iconSize >= 0.0),
      assert(unselectedIconTheme == null ||
          (unselectedIconTheme.color != null && unselectedIconTheme.size != null)),
      assert(selectedIconTheme == null ||
          (selectedIconTheme.color != null && selectedIconTheme.size != null)),
      super(key: key);