pub fn event_state<A: EventArgs, S: VarValue>(
child: impl UiNode,
state: impl IntoVar<S>,
default: S,
event: Event<A>,
on_event: impl FnMut(&A) -> Option<S> + Send + 'static,
) -> impl UiNode
Expand description
Helper for declaring state properties that depend on a single event.
When the event
is received on_event
is called, if it provides a new state the state
variable is set.