https://kotlinlang.org logo
#compose
Title
# compose
g

galex

07/19/2020, 6:14 PM
Slider
doesn’t follow the
steps
and lets me drag it all over. Is this a known bug? Is the main issue tracker the right place to report issues on material design compose lib?
m

matvei

07/20/2020, 11:55 AM
What would you expect to happen when you drag between steps? Just thumb to jump between states with to intermediate progress? It might make sense, but it will look like it's not responding, especially if space between steps is quite big. Take a look at the material spec here: https://material.io/components/sliders#discrete-sliders It will render thumb in between steps as well, but as long as you lift your finger -- it will snap to the closes anchor. So it works as intended for now.
I will ask our UX people to see if there's something we want to support / provide as opt-in. File a bug please on Jetpack Compose component 🙂
g

galex

07/20/2020, 1:32 PM
Ahh I see, I thought it would be like the implementation of the material library where it doesn’t behave like that. Sure, will do!
Ohhh I know what disturbed me so much! The
steps
parameter is how many steps we want in between, aka if I want 1 to 100 by steps of 10 I need to say
steps=10.
Before we would just set up stepSize… That’s why it felt super weird once I switched to Compose!
hmm not even correct, the right answer is 9 here, super weird….
m

matvei

07/20/2020, 1:47 PM
I think the answer is 8 🙂
steps
is the amount of steps between min and max bound. We probably need to explicitly say that in the param docs
g

galex

07/20/2020, 1:48 PM
IMHO it’s a better API pass a stepSize like it was set up previously -> https://material.io/develop/android/components/sliders
So that we don’t need to start calculating the number of steps in between, the component can do that itself right? 😳
m

matvei

07/20/2020, 1:55 PM
Yes, we can do this conversion internally. Thanks, I will thing about it. The reverse it also true, sometimes you care about the amount of steps, not the step size, so some of the usecases will be slightly harder then others in this case anyway. The questions is which is more popular and more usual
👍 1
88 Views