Home > Back-end >  Flutter - Slider change background color to transparence
Flutter - Slider change background color to transparence

Time:03-29

i want to change the background color of slider to transparence how i can do it ?

please look at the video:

youtube.com/watch?v=diHLGnkuxRE

I try slidertheme but there is no fonction of the background color :/

and this is my code:

new SliderTheme(data: SliderTheme.of(context).copyWith(
                      activeTrackColor: Colors.red,
                      inactiveTrackColor: Colors.grey,
                      trackHeight: 3.0,
                      thumbColor: Colors.blueAccent,
                      thumbShape: RoundSliderThumbShape(enabledThumbRadius: 8.0),
                      overlayColor: Colors.purple.withAlpha(32),

                      overlayShape: RoundSliderOverlayShape(overlayRadius: 14.0),
                    ), child: Expanded(child:Slider(value: _currentPosition.inSeconds.toDouble(), max: _musicLength.inSeconds.toDouble(), onChanged: (val){seekAudio(val.toInt());}),),),

CodePudding user response:

The grey background that you wish to remove is not part of the slider in your provided code. It must come from another widget in the widget tree.

Is your slider is within a container or other widget which has a background colour itself? Is there any widget, higher up the tree, that you can set the background colour of to 'Colors.transparent'?

  • Related