Skip to content
New issue

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

Add slider widget #171

Merged
merged 2 commits into from
Nov 13, 2023
Merged

Add slider widget #171

merged 2 commits into from
Nov 13, 2023

Conversation

jrmoulton
Copy link
Collaborator

The docs need updated but this works quite well

Screenshot 2023-11-12 at 10 09 34 PM
Screenshot 2023-11-12 at 10 08 55 PM
Screenshot 2023-11-12 at 10 08 35 PM
Screenshot 2023-11-12 at 10 08 02 PM

@jrmoulton
Copy link
Collaborator Author

stack((
    stack((
        widgets::slider::slider(|| 0.)
            .style(|s| {
                s.height(15)
                    .width(200)
                    .set(slider::BarExtends, true)
                    .set(slider::Thickness, 100.pct())
            })
            .on_change_pct(move |val| set_slider.set(val)),
        label(move || format!("Slider value: {:.1}%", get_slider.get() * 100.)),
    ))
    .style(|s| s.gap(5, 0)),
    stack((
        widgets::slider::slider(|| 0.)
            .style(|s| s.height(15).width(200))
            .on_change_pct(move |val| set_slider2.set(val)),
        label(move || format!("Slider value: {:.1}%", get_slider2.get() * 100.)),
    ))
    .style(|s| s.gap(5, 0)),
))
.style(|s| s.flex_col().gap(0, 10)),

Screenshot 2023-11-13 at 1 25 38 AM

Easy to customize

@dzhou121 dzhou121 merged commit 72167e4 into lapce:main Nov 13, 2023
7 checks passed
@dzhou121
Copy link
Contributor

Would you mind adding it to the widget-gallery?

@jrmoulton jrmoulton deleted the slider branch January 17, 2024 21:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants