Repository navigation
Overhauling Slider Widget #20026
Description
Hi,
I wanted to use a Slider in my current project and stumbled upon several weaknesses in the current design:
-
Material Slider track should be customizable. #19216 The current design that you have to use a SliderComponentShape if you want to customize the Thumb of a Slider is non intuitive and against the way Flutter typically builds its widgets. I would have expected to have the option to pass the size of the thumb and a builder function that gets the current slider value an returns a Widget that draws the Slider.
In the current approach I'm suddenly confronted with painting on a Canvas. If you want to output a Text inside the Thumb you need a TextPainter too. Not easy for starters and not in the Flutter philosophie of composing widgets. -
Your SliderComponentShape gets the current Slider value as percentage and not the absolute value although you pass limits to the Slider constructor as absolute Values.
-
If you set a minimum Value you suddenly get fractional value steps if you defined steps for the Slider.
-
If you have a big range of values the linear curve of the slider isn't enough there should be an exponential curve too that allows small intervals for small values and then bigger steps.
-
A way to pass unit Widgets that get displayed at the correct position below or above the Slider.
All of the above should also be supported by the coming RangeSlider.
Activity
zoechi commentedon Jul 31, 2018
escamoteur commentedon Jul 31, 2018
Ah yes I haven't even thought of the customizing the Slider track, I think it makes sense to have all in here.
slightfoot commentedon Jul 31, 2018
Here for reference: https://github.com/boeledi/RangeSlider
clocksmith commentedon Feb 25, 2019
4 and 5 should now be possible with the current API for the single slider
For 1, the Slider does not contain any sub widgets because it contains a RenderBox. There are many good examples of painting with the default shapes. I will also be updating the gallery with even more examples.
@escamoteur Can you confirm that the new shape painters can accomplish cases 4 and 5?
2 is also by design of the shape painters
For 3, I am not following 100%, but it seems like its working as intended by rendering tick marks after setting divisions. Is something else expected?
no-response commentedon May 14, 2019
Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now. Please don't hesitate to comment on the bug if you have any more information for us; we will reopen it right away!
Thanks for your contribution.
github-actions commentedon Aug 30, 2021
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.