FormState class

State for a Form component. This manages states for text input, focus and selection (single and multi).

Implementers

Constructors

FormState(List<FormConfig<FormConfigOption>> _configValues)
FormState.multiScreen(List<FormConfig<FormConfigOption>> configValues)
Creates a FormState configured for a multi-screen Form.
factory

Properties

configurations List<FormConfig<FormConfigOption>>
Mutable configurations which gets updated with this state.
final
focusedConfigIndex int
Index of the current configuration in focus.
no setter
hashCode int
The hash code for this object.
no setterinherited
maxFocusedConfigIndex int
Max index of focusable configurations.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

dispose() → void
Disposes all resources held by this state.
focusDown() → void
Moves focus to the next element vertically.
focusLeft() → void
Moves focus to the next element horizontally.
focusRight() → void
Moves focus to the previous element horizontally.
focusUp() → void
Moves focus to the previous element vertically.
getFocusedOptionIndexFor(FormConfig<FormConfigOption> config) int?
Returns the focused option for config.
getInputControllerFor(FormInputConfig config) ValidatingTextController?
Returns the ValidatingTextController for config, if any.
getInputFor(FormInputConfig config) String?
Returns the current input text for config, if any.
getSelectedOptionFor<T extends FormConfigOption>(FormConfig<T> config) → T?
Returns the selected FormConfigOption for config. For multi-select configs, use getSelectedOptionsFor instead.
getSelectedOptionsFor<T extends FormConfigOption>(FormConfig<T> config) Set<T>?
Returns all selected FormConfigOptions for config.
isOptionSelectedForConfig<T extends FormConfigOption>(FormConfig<T> config, T option) bool
Returns true if option is a selected option for config.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onSelect() → void
Selects the element that is in focus.
requestFocus(FormConfig<FormConfigOption> config) → void
Requests for config to be in focus.
selectConfigOption() → void
Updates the selected FormSelectionConfig for the focused FormConfig.
setValidator(FormInputConfig config, String? validator(String)?) → void
Sets a validator function for config that will run on every text change. The validator is persisted so it survives config removal and recreation when requirements are not met.
toString() String
A string representation of this object.
inherited
updateFocusedConfig(int delta) → void
Updates the focused FormConfig by delta.
updateFocusedConfigOption(int delta) → void
Updates the focused FormConfigOption for the focused FormConfig by delta.
updateInput(FormInputConfig config, String text) → void
Updates the input text for config with text.
updateSelectedOption(FormSelectionConfig<FormConfigOption> config, FormConfigOption option) → void
Sets option as a selected value for config.

Operators

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