MultiSelectFormField<T> class
A form field representing multiple-option selection from a list of choices.
Users navigate the list of options using Up and Down arrow keys, and toggle the selection status of the highlighted option using the Space bar or Enter key.
Example
MultiSelectFormField<String>(
label: 'Select tags',
initialValue: const ['dart'],
options: const [
MultiSelectOption('Dart', 'dart'),
MultiSelectOption('Flutter', 'flutter'),
MultiSelectOption('TUI', 'tui'),
],
)
- Inheritance
-
- Object
- Widget
- StatefulWidget
- FormField<
List< T> > - MultiSelectFormField
Constructors
-
MultiSelectFormField({required String label, String description = '', required List<
MultiSelectOption< options, List<T> >T> ? initialValue, String? validator(List<T> ?)?, bool focused = false}) -
Creates a MultiSelectFormField with the given
options.
Properties
- description → String
-
Optional secondary description text for helper information.
finalinherited
- errorText ↔ String?
-
The validation error text if validation fails; otherwise,
null.getter/setter pairinherited - focused ↔ bool
-
Whether this field currently has input focus.
getter/setter pairinherited
- hasError → bool
-
Returns whether this field currently contains a validation error.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
-
initialValue
→ List<
T> ? -
The initial value of the field when created or reset.
finalinherited
- key → Key?
-
The optional key for this widget.
finalinherited
- label → String
-
The title label displayed for this field.
finalinherited
-
options
→ List<
MultiSelectOption< T> > -
The list of available options for multiple selection.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- touched ↔ bool
-
Whether this field has been focused at least once.
getter/setter pairinherited
-
validator
→ String? Function(List<
T> ?)? -
A validation function called by FormState.validate.
Returns an error message string if invalid, or
nullif valid.finalinherited -
value
↔ List<
T> ? -
The current value of the form field.
getter/setter pairinherited
Methods
-
createElement(
) → Element -
Creates an Element to manage this widget's location in the tree.
inherited
-
createState(
) → State< StatefulWidget> -
Creates the mutable state for this widget at a given location in the tree.
override
-
getIntrinsicHeight(
int width) → int -
Computes the intrinsic height of this widget under the given
widthconstraint.inherited -
getPreferredHeight(
) → int -
Calculates preferred layout height needed to render this field cleanly.
override
-
handleKeyEvent(
KeyEvent event) → bool -
Handles user key inputs to update the internal value.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
render(
Buffer buffer, Rect area) → void -
Renders the widget onto the provided
bufferwithin the specifiedarea.inherited -
toString(
) → String -
A string representation of this object.
inherited
-
validate(
) → bool -
Runs the validator callback against the current field value.
Updates errorText and returns whether the field is valid.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited