Add step member to slider widgets

Both the native and the web slider now have a member `step` to control
the least possible change of the slider's value. It defaults to 1.0
for all sliders and can be adjusted with the step method.
This commit is contained in:
Sebastian Zivota 2020-06-02 20:34:13 +02:00
parent baa1389f71
commit c3643eaf6d
5 changed files with 81 additions and 33 deletions

View file

@ -500,15 +500,24 @@ impl<'a> Step {
.push(
Row::new()
.spacing(10)
.push(Slider::new(red, 0.0..=1.0, color.r, move |r| {
StepMessage::TextColorChanged(Color { r, ..color })
}))
.push(Slider::new(green, 0.0..=1.0, color.g, move |g| {
StepMessage::TextColorChanged(Color { g, ..color })
}))
.push(Slider::new(blue, 0.0..=1.0, color.b, move |b| {
StepMessage::TextColorChanged(Color { b, ..color })
})),
.push(
Slider::new(red, 0.0..=1.0, color.r, move |r| {
StepMessage::TextColorChanged(Color { r, ..color })
})
.step(0.01),
)
.push(
Slider::new(green, 0.0..=1.0, color.g, move |g| {
StepMessage::TextColorChanged(Color { g, ..color })
})
.step(0.01),
)
.push(
Slider::new(blue, 0.0..=1.0, color.b, move |b| {
StepMessage::TextColorChanged(Color { b, ..color })
})
.step(0.01),
),
);
Self::container("Text")