WidgetState enum
Interactive states that some of the widgets can take on when receiving input from the user.
States are defined by https://material.io/design/interaction/states.html#usage, but are not limited to the Material design system or library.
Some widgets track their current state in a Set<WidgetState>
.
See also:
- MaterialState, the Material specific version of
WidgetState
. - WidgetStateProperty, an interface for objects that "resolve" to different values depending on a widget's state.
- WidgetStateColor, a Color that implements
WidgetStateProperty
which is used in APIs that need to accept either a Color or aWidgetStateProperty<Color>
. - WidgetStateMouseCursor, a MouseCursor that implements
WidgetStateProperty
which is used in APIs that need to accept either a MouseCursor or a WidgetStateProperty<MouseCursor>. - WidgetStateOutlinedBorder, an OutlinedBorder that implements
WidgetStateProperty
which is used in APIs that need to accept either an OutlinedBorder or a WidgetStateProperty<OutlinedBorder>. - WidgetStateBorderSide, a BorderSide that implements
WidgetStateProperty
which is used in APIs that need to accept either a BorderSide or a WidgetStateProperty<BorderSide>. - WidgetStateTextStyle, a TextStyle that implements
WidgetStateProperty
which is used in APIs that need to accept either a TextStyle or a WidgetStateProperty<TextStyle>.
- Inheritance
- Implemented types
- Available extensions
Values
- hovered → const WidgetState
-
The state when the user drags their mouse cursor over the given widget.
See: https://material.io/design/interaction/states.html#hover.
- focused → const WidgetState
-
The state when the user navigates with the keyboard to a given widget.
This can also sometimes be triggered when a widget is tapped. For example, when a TextField is tapped, it becomes focused.
See: https://material.io/design/interaction/states.html#focus.
- pressed → const WidgetState
-
The state when the user is actively pressing down on the given widget.
See: https://material.io/design/interaction/states.html#pressed.
- dragged → const WidgetState
-
The state when this widget is being dragged from one place to another by the user.
- selected → const WidgetState
-
The state when this item has been selected.
This applies to things that can be toggled (such as chips and checkboxes) and things that are selected from a set of options (such as tabs and radio buttons).
See: https://material.io/design/interaction/states.html#selected.
- scrolledUnder → const WidgetState
-
The state when this widget overlaps the content of a scrollable below.
Used by AppBar to indicate that the primary scrollable's content has scrolled up and behind the app bar.
- disabled → const WidgetState
-
The state when this widget is disabled and cannot be interacted with.
Disabled widgets should not respond to hover, focus, press, or drag interactions.
See: https://material.io/design/interaction/states.html#disabled.
- error → const WidgetState
-
The state when the widget has entered some form of invalid state.
See https://material.io/design/interaction/states.html#usage.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- index → int
-
A numeric identifier for the enumerated value.
no setterinherited
- name → String
-
Available on Enum, provided by the EnumName extension
The name of the enum value.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
isSatisfiedBy(
Set< WidgetState> states) → bool -
Whether the provided
states
satisfy this object's criteria.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator &(
WidgetStatesConstraint other) → WidgetStatesConstraint -
Available on WidgetStatesConstraint, provided by the WidgetStateOperators extension
Combines two WidgetStatesConstraint values using logical "and". -
operator ==(
Object other) → bool -
The equality operator.
inherited
-
operator |(
WidgetStatesConstraint other) → WidgetStatesConstraint -
Available on WidgetStatesConstraint, provided by the WidgetStateOperators extension
Combines two WidgetStatesConstraint values using logical "or". -
operator ~(
) → WidgetStatesConstraint -
Available on WidgetStatesConstraint, provided by the WidgetStateOperators extension
Takes a WidgetStatesConstraint and applies the logical "not".
Constants
- any → const WidgetStatesConstraint
- To prevent a situation where each WidgetStatesConstraint isn't satisfied by the given set of states, consier adding WidgetState.any as the final WidgetStateMap key.
-
values
→ const List<
WidgetState> - A constant List of the values in this enum, in order of their declaration.