WidgetEventController class

Manages a set of WidgetEvents and notifies listeners of changes.

Used by widgets that expose their internal event for the sake of extensions that add support for additional events.

The controller's value is its current set of events. Listeners are notified whenever the value changes. The value should only be changed with update; it should not be modified directly.

Inheritance
Mixed-in types

Constructors

WidgetEventController([Set<WidgetEvent>? events, ValueSetter<Set<WidgetEvent>>? onChanged])
Creates a new instance of WidgetEventController.
WidgetEventController.by({bool focused = false, bool hovered = false, bool pressed = false, bool dragged = false, bool selected = false, bool indeterminate = false, bool disabled = false, bool error = false, bool loading = false, ValueSetter<Set<WidgetEvent>>? onChanged})
Creates a new instance of WidgetEventController.
WidgetEventController.reg(Map<WidgetEvent, bool> registry, {ValueSetter<Set<WidgetEvent>>? onChanged})
Creates a new instance of WidgetEventController based on a map of events.
WidgetEventController.value(Set<WidgetEvent> events, {ValueSetter<Set<WidgetEvent>>? onChanged})
Creates a new instance of WidgetEventController with a specific set of events.

Properties

hashCode int
The hash code for this object.
no setterinherited
hasListeners bool
Whether any listeners are currently registered.
no setterinherited
isDisabled bool
Getter for whether WidgetEvent.disabled to be active.
no setter
isDragged bool
Getter for whether WidgetEvent.dragged to be active.
no setter
isErrored bool
Getter for whether WidgetEvent.error to be active.
no setter
isFocused bool
Getter for whether WidgetEvent.focused to be active.
no setter
isHovered bool
Getter for whether WidgetEvent.hovered to be active.
no setter
isIndeterminate bool
Getter for whether WidgetEvent.indeterminate to be active.
no setter
isLoading bool
Getter for whether WidgetEvent.loading to be active.
no setter
isPressed bool
Getter for whether WidgetEvent.pressed to be active.
no setter
isSelected bool
Getter for whether WidgetEvent.selected to be active.
no setter
onChanged ValueSetter<Set<WidgetEvent>>?
Called whenever the set of active WidgetEvents changes.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
value Set<WidgetEvent>
Managed set of active WidgetEvent values; designed to be passed to DrivenProperty.resolve methods.
getter/setter pair

Methods

add(WidgetEvent event) → void
Mutator to mark a T value as active.
addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
clear() → void
Removes all elements from the value.
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
override
dispose() → void
Discards any resources used by the object. After this is called, the object is not in a usable state and should be discarded (calls to addListener will throw after the object is disposed).
inherited
emit(WidgetEvent event, {ValueChanged<bool>? onChanged}) ValueChanged<bool>
Callback factory which accepts a T value and returns a closure to mutate value and call setState.
merge(Set<WidgetEvent> events) → void
Merge value with a new set of WidgetEvent.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
override
remove(WidgetEvent event) → void
Mutator to mark a T value as inactive.
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
replace(Set<WidgetEvent> events) → void
Replace value with a new set of WidgetEvent.
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toggle(WidgetEvent event, [bool? active]) → void
Mutator to mark a T value as either active or inactive.
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringShort() String
A brief description of this object, usually just the runtimeType and the hashCode.
inherited
update(Map<WidgetEvent, bool> registry, {bool forceNotify = false}) → void
Updates the value set with a map of WidgetEvents and their desired states.

Operators

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