WidgetStateOperators extension
These operators can be used inside a WidgetStateMap to combine states and find a match.
Example:
final WidgetStatesConstraint constraint = WidgetState.focused | WidgetState.hovered;
In the above case, constraint.isSatisfiedBy(states)
is equivalent to:
states.contains(WidgetState.focused) || states.contains(WidgetState.hovered);
Since enums can't extend other classes, WidgetState instead implements
the WidgetStatesConstraint interface. This extension
ensures that
the operators can be used without being directly inherited.
Operators
-
operator &(
WidgetStatesConstraint other) → WidgetStatesConstraint -
Available on WidgetStatesConstraint, provided by the WidgetStateOperators extension
Combines two WidgetStatesConstraint values using logical "and". -
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".