I have a simple Slider widget and I want to add multiple containers inside the track at different points.
Current Code
Slider(
max: 500,
value: _playerValue,
onChanged: (double value){
setState(() {
_playerValue = value;
});
},
),
I do not think this is possible only by using the
SliderThemeData
; or at least, no way that I am aware of. However, you can achieve this behaviour usingStack
, with the markers shown behind a translucent track of the slider. Demo snippet below.One thing to note is to make sure the container that has the stack of markers has horizontal margin that is same as the slider's overlay radius; otherwise, the marker container becomes wider than the track.
IMPORTANT: I put this snippet together rapidly only to demonstrate the possibility of showing markers behind a slider's track. The dimensions of the track and the markers are hard-coded, which is very likely not what you want. I do not recommend using it as is, but only as a guide.