We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I observed the following when putting a View into a disabled state:
Here's a live demo:
Source code for the demo:
use floem::kurbo::Size; use floem::peniko::Color; use floem::reactive::{create_signal, ReadSignal, WriteSignal}; use floem::style::AlignItems; use floem::view::View; use floem::views::{h_stack, label, v_stack, Decorators}; use floem::widgets::{button, checkbox}; use floem::window::WindowConfig; use floem::EventPropagation; fn my_button(label: &'static str) -> impl View { button(move || label).style(|s| { s.background(Color::GREEN) .color(Color::WHITE) .disabled(|s| s.background(Color::DARK_GRAY)) .font_size(18.0) .padding(5.0) }) } fn spinbox(counter: ReadSignal<i32>, set_counter: WriteSignal<i32>) -> impl View { h_stack(( my_button("-").on_click(move |_| { set_counter.update(|value| *value -= 1); EventPropagation::Stop }), label(move || counter.get()), my_button("+").on_click(move |_| { set_counter.update(|value| *value += 1); EventPropagation::Stop }), )) .style(|s| { s.align_items(AlignItems::Center) .disabled(|s| s.background(Color::DIM_GRAY)) .gap(10.0, 0.0) }) } fn app_view() -> impl View { let (spinbox_enabled, set_spinbox_enabled) = create_signal(true); let (counter, set_counter) = create_signal(0); v_stack(( checkbox(spinbox_enabled) .on_click_stop(move |_| set_spinbox_enabled.set(!spinbox_enabled.get())), spinbox(counter, set_counter).disabled(move || !spinbox_enabled.get()), )) } fn main() { let window_config = WindowConfig::default().size(Size { width: 200.0, height: 100.0, }); floem::Application::new() .window(move |_| app_view(), Some(window_config)) .run() }
To be consistent, I think disabled styling should apply whenever disabled behavior is into effect.
I'll see if I can write a fix and submit a PR, but I'm still pretty new to Floem. Fix ready at #231.
The text was updated successfully, but these errors were encountered:
Addressed by e795021.
Sorry, something went wrong.
No branches or pull requests
I observed the following when putting a View into a disabled state:
Here's a live demo:
tmp.mp4
Source code for the demo:
To be consistent, I think disabled styling should apply whenever disabled behavior is into effect.
I'll see if I can write a fix and submit a PR, but I'm still pretty new to Floem.Fix ready at #231.The text was updated successfully, but these errors were encountered: