ObjectSegmentedField<T> class final

A Field that builds SegmentedButton<T> for Object values.

Inheritance

Constructors

ObjectSegmentedField({required String name, required List<T> values, T? initialValue, LabelBuilder<T> labelBuilder = defaultLabelBuilder, @Deprecated('Fields should not be aware of their context') void onChanged(BuildContext context, T? value)?})
Creates a new instance of ObjectSegmentedField.

Properties

hashCode int
The hash code for this object.
no setterinherited
initialValue → 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 → LabelBuilder<T>
Encoder for converting value of type T to a query parameter.
finalinherited
toValue → T? Function(String param)
Decoders for converting a query parameter to a value of type T. Can return null if the parameter is invalid.
finalinherited
values List<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, T value) Widget
Converts this field into a Widget that can be used in the settings panel.
override
updateField(BuildContext context, String groupName, T value) → void
Updates the field value in the WidgetbookState and synchronizes it with the URL query parameters.
inherited
valueFrom(QueryGroup? group) → 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.