WidgetEventController.by constructor
WidgetEventController.by({})
Creates a new instance of WidgetEventController.
Optionally allows setting the initial state of the events.
focused
: Whether the widget is currently focused.hovered
: Whether the widget is currently hovered.pressed
: Whether the widget is currently pressed.dragged
: Whether the widget is currently dragged.selected
: Whether the widget is currently selected.disabled
: Whether the widget is currently disabled.indeterminate
: Whether the widget is currently indeterminate.error
: Whether the widget is currently in an error state.loading
: Whether the widget is currently loading.- onChanged: A callback that will be invoked whenever the set of active events changes.
Implementation
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,
this.onChanged,
}) : value = ({
WidgetEvent.focused: focused,
WidgetEvent.hovered: hovered,
WidgetEvent.pressed: pressed,
WidgetEvent.dragged: dragged,
WidgetEvent.selected: selected,
WidgetEvent.indeterminate: indeterminate,
WidgetEvent.disabled: disabled,
WidgetEvent.error: error,
WidgetEvent.loading: loading,
}..removeWhere((key, value) => !value))
.keys
.toSet();