Created
December 16, 2025 18:33
-
-
Save fredgrott/871be6f9da2df6511e16f662e9acb359 to your computer and use it in GitHub Desktop.
WidgetStateExt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| extension WidgetStateHelpers on Iterable<WidgetState> { | |
| bool get isHovered => contains(WidgetState.hovered); | |
| bool get isFocused => contains(WidgetState.focused); | |
| bool get isPressed => contains(WidgetState.pressed); | |
| bool get isDragged => contains(WidgetState.dragged); | |
| bool get isSelected => contains(WidgetState.selected); | |
| bool get isScrolledUnder => contains(WidgetState.scrolledUnder); | |
| bool get isDisabled => contains(WidgetState.disabled); | |
| bool get isError => contains(WidgetState.error); | |
| } | |
| extension IterableExtensions on Iterable { | |
| bool containsAny(Iterable<Object?> other) => other.any((e) => contains(e)); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment