-
Notifications
You must be signed in to change notification settings - Fork 614
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
Feature/inverted slider #4705
base: master
Are you sure you want to change the base?
Feature/inverted slider #4705
Conversation
Thanks for the PR :). Could you explain to us what the use-case is for this? |
I'd love to! For the user using the UI, a vertical slider with the highest value on top is desired, because that feels more intuitive than having the high value at the bottom, as it is right now. One solution to this could be to give the two-way binding some bijective function to invert the values, but I could not figure out how to do this. So I figured that one easy to use approach would be to invert the slider. If this behavior could be achieved another way, I would be happy if you could explain it to me. I could certainly implement a custom widget with this behavior, but I think this use case is common enough for a general implementation. |
Ahhh, now I see. Thank you! Perhaps we've made a mistake in our API design here, and we should have We could rename those and keep the old names for compatibility. Such a direction would be my preference over a boolean inversion. Florian, what do you think? |
That would be cleaner, yes. |
We should also look at the guidelines from the platform and depending we might need to make sure that it is in the right direction by default |
Could you clarify what platforms you have in mind? Or instead of platforms, do you mean right-to-left vs. left-to-right when used in locales where we want to mirror layouts? |
On further thoughts, in my opinion, in the short term this particular feature - support for inverted ranges - could be implemented without changing the API but by automatically supporting the case when the minimum is greater than the maximum and implicitly "inverting". Basically treating "minimum" as "from" and "maximum" as "to" - as if we had given them these names from the beginning. |
I mean Windows for fluent, Mac for cuppertino and so on. For example, the fluent design says:
But we have it by default in the wrong direction: Not sure what mac does. But I'd say the first thing we should do before having this feature is to fix the vertical slider so it's not upside down by default. |
So there are two issues:
|
Adds a new inverted property to the slider widget to change the direction of the slider.
PR includes needed adaptations for fluent, cosmic, material and cupertino styles.
Tested with different values and horizontal as well as vertical orientation.