I would like to know how to create a slider to change the text size.
This is the design.
あ = A
i want increase +0.05
My code is bad . because i can not made same design .
CupertinoSlider(
min: 0.1,
max: 0.6,
value: clockTextSize.toDouble(),
onChanged: (_value) {
setState(
() {
clockTextSize = _value.toInt();
},
);
},
)
2
Answers
you can set division property to achieve this. see documentation
For example, if
min
is0.1
andmax
is0.6
anddivisions
is5
, then the slider can take on the values discrete values 0.1, 0.2, 0.3, 0.4, 0.5, and 0.6.then in your case, if you want increase
+0.05
, you can set thedivision=10
result:
Note: your question wasn’t too clear if you’re looking to achieve the same design or regarding the divisions. This answer is how to achieve the same design.
Result
Customization
To customize the
Slider
to your liking, you can useSliderTheme
.Then, to customize the Tick, you can create your own class that
extend
sSliderTickMarkShape
.Code
See also
How can I customize Slider widget in Flutter?