Cyber Avater
Cyber Avater

Reputation: 2147

How to set slider overlay color?

I'm trying to set slider overlay color but it seems that it only works if I comment out overlayShape: RoundSliderThumbShape(enabledThumbRadius: 30), how to I set both? P.S. Relevant part code is marked with comments

SliderTheme(
                          data: SliderTheme.of(context).copyWith(
                            activeTrackColor: kDefaultColor,
                            inactiveTrackColor: kDefaultColor,
                            thumbColor: kButtonColor,
                            thumbShape: RoundSliderThumbShape(enabledThumbRadius: 15),
                            overlayShape: RoundSliderThumbShape(enabledThumbRadius: 30), //focus here
                            overlayColor: Colors.red  //focus here
                          ),
                          child: Slider(
                            value: sliderValue.toDouble(),
                            max: 220,
                            min: 110,
                            onChanged: (double value) {
                              setState(() {
                                sliderValue = value.round();
                              });
                            },
                          ),
                        ),

Upvotes: 2

Views: 345

Answers (1)

Arun
Arun

Reputation: 316

You should use RoundSliderOverlayShape for overlayShape.

overlayShape: RoundSliderOverlayShape(overlayRadius: 30),

Upvotes: 2

Related Questions