mirror of
https://github.com/danbulant/cushy
synced 2026-06-10 18:13:48 +00:00
This reduces the complexity of operations capable with Dynamic, and also makes it easier to shortcut deadlocking operations.
20 lines
591 B
Rust
20 lines
591 B
Rust
use gooey::value::Dynamic;
|
|
use gooey::widget::MakeWidget;
|
|
use gooey::widgets::checkbox::{Checkable, CheckboxState};
|
|
use gooey::Run;
|
|
|
|
fn main() -> gooey::Result {
|
|
let checkbox_state = Dynamic::new(CheckboxState::Checked);
|
|
let label = checkbox_state.map_each(|state| format!("Check Me! Current: {state:?}"));
|
|
|
|
checkbox_state
|
|
.clone()
|
|
.into_checkbox(label)
|
|
.and("Maybe".into_button().on_click(move |()| {
|
|
checkbox_state.set(CheckboxState::Indeterminant);
|
|
}))
|
|
.into_columns()
|
|
.centered()
|
|
.expand()
|
|
.run()
|
|
}
|