A switch with text, on or off.
.on_toggle(f) sends what f makes of the new state.
Signature
pub const fn switch<M>(text: &str, on: bool) -> Switch<'_, M>Methods
.on_toggle(f: fn(bool) -> M) -> Self— Sends a message made from the new state when it is toggled.
Example
use fusuma::{column, switch};
let view = column((switch("Wi-Fi", true).on_toggle(|on| on),));
let built = fusuma::doc::built::<bool, _>(&view);
assert_eq!(built.texts(), ["Wi-Fi"]);