IterableSegmentedField<T> class
A Field that builds SegmentedButton<Iterable<T>> for Iterable values.
Constructors
-
IterableSegmentedField({required String name, required Iterable<
T> values, required Iterable<T> initialValue, LabelBuilder<T> labelBuilder = defaultLabelBuilder, bool emptySelectionAllowed = true, @Deprecated('Fields should not be aware of their context') void onChanged(BuildContext context, Iterable<T> ? value)?}) - Creates a new instance of IterableSegmentedField.
Properties
- emptySelectionAllowed → bool
-
Whether empty selection is allowed. InitialOption must not be empty if this is false.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
initialValue
→ Iterable<
T> -
The default value when no value is specified.
finalinherited
-
labelBuilder
→ LabelBuilder<
T> -
The function to build the label for each value in the segmented button.
final
- name → String
-
The unique identifier for this field within its group.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
toParam
→ String Function(Iterable<
T> value) -
Encoder for converting value of type
Tto a query parameter.finalinherited -
toValue
→ Iterable<
T> ? Function(String param) -
Decoders for converting a query parameter to a value of type
T. Can returnnullif the parameter is invalid.finalinherited -
values
→ Iterable<
T> -
The list of values to display in the segmented button.
final
Methods
-
build(
BuildContext context, String groupName) → Widget -
Builds the current field into a Widget using toWidget.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
toWidget(
BuildContext context, String groupName, Iterable< T> value) → Widget -
Converts this field into a Widget that can be used in the
settings panel.
override
-
updateField(
BuildContext context, String groupName, Iterable< T> value) → void -
Updates the field value in the WidgetbookState and synchronizes it
with the URL query parameters.
inherited
-
valueFrom(
QueryGroup? group) → Iterable< T> -
Extracts the value from
group, fallback to initialValue if field is not found or cannot be decoded.inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
defaultLabelBuilder(
dynamic value) → String - The default label builder that converts the value to a string.