Expand description
Sliders let users set a value by moving an indicator.
§Example
use iced::widget::slider;
struct State {
value: f32,
}
#[derive(Debug, Clone)]
enum Message {
ValueChanged(f32),
}
fn view(state: &State) -> Element<'_, Message> {
slider(0.0..=100.0, state.value, Message::ValueChanged).into()
}
fn update(state: &mut State, message: Message) {
match message {
Message::ValueChanged(value) => {
state.value = value;
}
}
}
Re-exports§
pub use crate::slider::default;
pub use crate::slider::Catalog;
pub use crate::slider::Handle;
pub use crate::slider::HandleShape;
pub use crate::slider::RailBackground;
pub use crate::slider::Status;
pub use crate::slider::Style;
pub use crate::slider::StyleFn;
Structs§
- An vertical bar and a handle that selects a single value from a range of values.