zng_wgt::node

Function widget_state_is_state

source
pub fn widget_state_is_state(
    child: impl UiNode,
    predicate: impl Fn(StateMapRef<'_, WIDGET>) -> bool + Send + 'static,
    deinit: impl Fn(StateMapRef<'_, WIDGET>) -> bool + Send + 'static,
    state: impl IntoVar<bool>,
) -> impl UiNode
Expand description

Helper for declaring state properties that are controlled by values in the widget state map.

The predicate closure is called with the widget state on init and every update, if the returned value changes the state updates. The deinit closure is called on deinit to get the reset value.