ChipsChoice<T>.single constructor
- Key? key,
- required T? value,
- required C2Changed<
T> onChanged, - List<
C2Choice< choiceItems = const [],T> > - C2ChoiceLoader<
T> ? choiceLoader, - C2ChipStyle? choiceStyle,
- bool choiceCheckmark = false,
- C2Builder<
T> ? choiceLabelBuilder, - C2Builder<
T> ? choiceLeadingBuilder, - C2Builder<
T> ? choiceTrailingBuilder, - C2Builder<
T> ? choiceBuilder, - WidgetBuilder? spinnerBuilder,
- WidgetBuilder? placeholderBuilder,
- WidgetBuilder? errorBuilder,
- bool wrapped = false,
- EdgeInsetsGeometry? padding,
- Axis direction = Axis.horizontal,
- VerticalDirection verticalDirection = VerticalDirection.down,
- TextDirection? textDirection,
- Clip clipBehavior = Clip.hardEdge,
- ScrollPhysics? scrollPhysics,
- MainAxisSize mainAxisSize = MainAxisSize.max,
- MainAxisAlignment mainAxisAlignment = MainAxisAlignment.start,
- CrossAxisAlignment crossAxisAlignment = CrossAxisAlignment.center,
- WrapAlignment alignment = WrapAlignment.start,
- WrapAlignment runAlignment = WrapAlignment.start,
- WrapCrossAlignment wrapCrossAlignment = WrapCrossAlignment.center,
- double spacing = 10,
- double runSpacing = 10,
- String? placeholder,
- TextStyle? placeholderStyle,
- TextAlign? placeholderAlign,
- TextStyle? errorStyle,
- TextAlign? errorAlign,
- double? spinnerSize,
- Color? spinnerColor,
- double? spinnerThickness,
- Widget? leading,
- Widget? trailing,
- ScrollController? scrollController,
- bool scrollToSelectedOnChanged = false,
Constructor for single choice
The value
is current selected value
The onChanged
called when value changed
The choiceItems is List of C2Choice item to generate the choices
The choiceLoader is function to load the choice items
The choiceStyle is a configuration for styling unselected choice widget
The choiceActiveStyle
is a configuration for styling selected choice widget
The choiceLabelBuilder is builder for custom label of the choice item
The choiceAvatarBuilder
is builder for custom avatar of the choice item
The choiceBuilder is builder for custom choice item widget
The spinnerBuilder is builder for custom spinner widget
The placeholderBuilder is builder for custom placeholder widget
The errorBuilder is builder for custom error widget
The wrapped is whether the chips is wrapped or scrollable
The padding is padding of the list container
The direction is the direction to use as the main axis
The verticalDirection is determines the order to lay children out vertically and how to interpret start and end in the vertical direction
The textDirection is determines the order to lay children out horizontally and how to interpret start and end in the horizontal direction
The clipBehavior is clip behavior of the list container
The scrollPhysics is how the scroll view should respond to user input, if Wrapped
is false
The mainAxisSize is how much space should be occupied in the main axis, if wrapped is false
The mainAxisAlignment is how the children should be placed along the main axis, if wrapped is false
The crossAxisAlignment is how the children should be placed along the cross axis, if wrapped is false
The alignment is determines how wrap will align the objects, if wrapped is true
The runAlignment is how the runs themselves should be placed in the cross axis, if wrapped is true
The wrapCrossAlignment is how the children within a run should be aligned relative to each other in the cross axis, if wrapped is true
The spacing is how much space to place between children in a run in the main axis, if wrapped is true
The runSpacing is how much space to place between the runs themselves in the cross axis, if wrapped is true
The placeholder is string to display when there is no choice items
The placeholderStyle is text style for default placeholder widget
The placeholderAlign is text align for default placeholder widget
The errorStyle is text style for default error widget
The errorAlign is text align for default error widget
The spinnerSize is size of the default spinner widget
The spinnerColor is color of the default spinner widget
The spinnerThickness is thickness of the default spinner widget
The leading is custom widget that inserted before the first choice item
The trailing is custom widget that inserted after the last choice item
The scrollController used when the choice items is scrollable or wrapped is not true
Implementation
ChipsChoice.single({
Key? key,
required T? value,
required C2Changed<T> onChanged,
this.choiceItems = const [],
this.choiceLoader,
this.choiceStyle,
this.choiceCheckmark = false,
this.choiceLabelBuilder,
this.choiceLeadingBuilder,
this.choiceTrailingBuilder,
this.choiceBuilder,
this.spinnerBuilder,
this.placeholderBuilder,
this.errorBuilder,
this.wrapped = false,
this.padding,
this.direction = Axis.horizontal,
this.verticalDirection = VerticalDirection.down,
this.textDirection,
this.clipBehavior = Clip.hardEdge,
this.scrollPhysics,
this.mainAxisSize = MainAxisSize.max,
this.mainAxisAlignment = MainAxisAlignment.start,
this.crossAxisAlignment = CrossAxisAlignment.center,
this.alignment = WrapAlignment.start,
this.runAlignment = WrapAlignment.start,
this.wrapCrossAlignment = WrapCrossAlignment.center,
this.spacing = 10,
this.runSpacing = 10,
this.placeholder,
this.placeholderStyle,
this.placeholderAlign,
this.errorStyle,
this.errorAlign,
this.spinnerSize,
this.spinnerColor,
this.spinnerThickness,
this.leading,
this.trailing,
this.scrollController,
this.scrollToSelectedOnChanged = false,
}) : assert(
choiceItems.isNotEmpty || choiceLoader != null,
'One of the parameters must be provided',
),
isMultiChoice = false,
singleValue = value,
singleOnChanged = onChanged,
multiValue = const [],
multiOnChanged = null,
super(key: key);