Just trying the stepper, and one part confused me! To try it out, tried a hard-coded example, which illustrates:
Stepper(
value = curr.value,
onValueChange = { value ->
curr.value = value
Log.i(TAG, "New value: $value")
},
valueRange = 100.0f .. 220.0f,
steps = (220 - 100) / 5 - 1
) {
Aim was to be able to have a range of 100 to 220 and be able to step values by 5.
The part that confused me was the
steps
value. Docs say "Step value is calculated as the difference between min and max values divided by steps+1". So, to get the correct step size, I have to subtract one from what I initially thought as the intuitive number of steps (
(220 - 100) / 5
). It's no big deal, reading the documentation solved it, just wasn't sure why "steps+1", though I've likely just misunderstood something.