CircleBNB constructor

const CircleBNB({
  1. Key? key,
  2. Size size = Size.zero,
  3. List<Color>? colorList,
  4. required double dragSpeed,
  5. required List<CircleBNBItem> items,
  6. required dynamic onChangeIndex(
    1. int index
    ),
  7. NavigationStyle navigationStyle = NavigationStyle.linear,
  8. int? linearItemCount = 3,
  9. bool showIconWhenSelected = true,
  10. bool showIconWhenUnselected = true,
  11. bool showTextWhenSelected = true,
  12. bool showTextWhenUnselected = true,
  13. Color? selectedIconColor,
  14. TextStyle? selectedTextStyle,
  15. Color? unselectedIconColor,
  16. TextStyle? unselectedTextStyle,
  17. Color? circularBackgroundColor,
  18. Color? linearBackgroundColor,
})

Implementation

const CircleBNB({
  super.key,
  this.size = Size.zero,
  this.colorList,
  required this.dragSpeed,
  required this.items,
  required this.onChangeIndex,
  this.navigationStyle = NavigationStyle.linear,
  this.linearItemCount = 3,
  this.showIconWhenSelected = true,
  this.showIconWhenUnselected = true,
  this.showTextWhenSelected = true,
  this.showTextWhenUnselected = true,
  this.selectedIconColor,
  this.selectedTextStyle,
  this.unselectedIconColor,
  this.unselectedTextStyle,
  this.circularBackgroundColor,
  this.linearBackgroundColor,
}) : assert(items.length >= 3, 'items must contain more than 3 elements.'),
     assert(colorList == null || colorList.length == 4, 'colorList must be null or have more than 4 elements.'),
     assert(linearItemCount == null || (linearItemCount % 2 == 1 && linearItemCount <= 5 && linearItemCount <= items.length), 'linearItemCount must be an odd number, no more than 5 and not greater than the number of items.'),
     assert(linearItemCount == null || !(navigationStyle == NavigationStyle.linear && linearItemCount > items.length), 'linearItemCount cannot be greater than the number of items when using linear navigation style.'),
     assert(showIconWhenSelected || showTextWhenSelected, 'showIconWhenSelected and showTextWhenSelected cannot both be false.'),
     assert(showIconWhenUnselected || showTextWhenUnselected, 'showIconWhenUnselected and showTextWhenUnselected cannot both be false.');