CircleBNB constructor
const
CircleBNB({
- Key? key,
- Size size = Size.zero,
- List<
Color> ? colorList, - required double dragSpeed,
- required List<
CircleBNBItem> items, - required dynamic onChangeIndex(
- int index
- int? linearItemCount = 3,
- bool showIconWhenSelected = true,
- bool showIconWhenUnselected = true,
- bool showTextWhenSelected = true,
- bool showTextWhenUnselected = true,
- Color? selectedIconColor,
- TextStyle? selectedTextStyle,
- Color? unselectedIconColor,
- TextStyle? unselectedTextStyle,
- Color? circularBackgroundColor,
- 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.');