ChipsChoice<T> class

Easy way to provide a single or multiple choice chips

Inheritance

Constructors

ChipsChoice.multiple({Key? key, required List<T> value, required C2Changed<List<T>> onChanged, List<C2Choice<T>> choiceItems = const [], 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 multiple choice
ChipsChoice.single({Key? key, required T? value, required C2Changed<T> onChanged, List<C2Choice<T>> choiceItems = const [], 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

Properties

alignment WrapAlignment
If wrapped is true, determines how wrap will align the objects
final
choiceBuilder C2Builder<T>?
Builder for custom choice item widget
final
choiceCheckmark bool
Configuration for styling unselected choice widget
final
choiceItems List<C2Choice<T>>
List of choice item
final
choiceLabelBuilder C2Builder<T>?
Builder for custom label of the choice item
final
choiceLeadingBuilder C2Builder<T>?
Builder for custom widget to display prior to the chip's label.
final
choiceLoader C2ChoiceLoader<T>?
Function to load the choice items
final
choiceStyle C2ChipStyle?
Configuration for styling unselected choice widget
final
choiceTrailingBuilder C2Builder<T>?
Builder for custom widget to display next to the chip's label.
final
clipBehavior Clip
Clip behavior of the list container
final
crossAxisAlignment CrossAxisAlignment
If wrapped is false, How the children should be placed along the cross axis
final
direction Axis
The direction to use as the main axis
final
errorAlign TextAlign?
Text align for default error widget
final
errorBuilder WidgetBuilder?
Builder for custom error widget
final
errorStyle TextStyle?
Text style for default error widget
final
hashCode int
The hash code for this object.
no setterinherited
isMultiChoice bool
Whether show the choice items as single choice or multiple choice
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
leading Widget?
Custom widget that inserted before the first choice item
final
mainAxisAlignment MainAxisAlignment
If wrapped is false, How the children should be placed along the main axis
final
mainAxisSize MainAxisSize
If wrapped is false, How much space should be occupied in the main axis
final
multiOnChanged C2Changed<List<T>>?
Called when value changed in multiple choice widget
final
multiValue List<T>
Initial value for multiple choice widget
final
padding EdgeInsetsGeometry?
Padding of the list container
final
placeholder String?
String to display when there is no choice items
final
placeholderAlign TextAlign?
Text align for default placeholder widget
final
placeholderBuilder WidgetBuilder?
Builder for custom placeholder widget
final
placeholderStyle TextStyle?
Text style for default placeholder widget
final
runAlignment WrapAlignment
If wrapped is true, how the runs themselves should be placed in the cross axis
final
runSpacing double
If wrapped is true, how much space to place between the runs themselves in the cross axis
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scrollController ScrollController?
Used when the choice items is scrollable or wrapped is not true
final
scrollPhysics ScrollPhysics?
If wrapped is false, How the scroll view should respond to user input
final
scrollToSelectedOnChanged bool
scroll to selected value on external value changed
final
singleOnChanged C2Changed<T>?
Called when value changed in single choice widget
final
singleValue → T?
Initial value for single choice widget
final
spacing double
If wrapped is true, how much space to place between children in a run in the main axis
final
spinnerBuilder WidgetBuilder?
Builder for custom spinner widget
final
spinnerColor Color?
Color of the default spinner widget
final
spinnerSize double?
Size of the default spinner widget
final
spinnerThickness double?
Thickness of the default spinner widget
final
textDirection TextDirection?
Determines the order to lay children out horizontally and how to interpret start and end in the horizontal direction
final
trailing Widget?
Custom widget that inserted after the last choice item
final
verticalDirection VerticalDirection
Determines the order to lay children out vertically and how to interpret start and end in the vertical direction
final
wrapCrossAlignment WrapCrossAlignment
If wrapped is true, how the children within a run should be aligned relative to each other in the cross axis
final
wrapped bool
Whether the chips is wrapped or scrollable
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() C2State<T>
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

defaultPadding EdgeInsetsGeometry
Default padding for spinner and placeholder
final
defaultPlaceholder String
Default placeholder string
final
defaultScrollableChipMargin EdgeInsetsGeometry
Default chip margin in scrollable list
final
defaultScrollablePadding EdgeInsetsGeometry
Default padding for scrollable list
final
defaultWrappedChipMargin EdgeInsetsGeometry
Default chip margin in wrapped list
final
defaultWrappedPadding EdgeInsetsGeometry
Default padding for wrapped list
final