0

I'm working on Slider, I want to change the thumb color, but this is not working. thumbColor accepts color from Child:Slider activeColor.

SliderTheme(

              data:SliderTheme.of(context).copyWith(
                // thumbShape: RoundSliderThumbShape(enabledThumbRadius: 19.0),
                // overlayColor: Colors.grey,
                thumbColor: Colors.white,

              ),
              child: Slider(
                inactiveColor: Colors.transparent,
                min: 0,

                activeColor: Color(0xffF3C961),
                value: value.toDouble(),
                max: MediaQuery.of(context).size.height,
                onChanged: (changedValue){
                  setState(() {

                    value = changedValue.toInt();

                  });
                },
              ),
            ),[![You can check color of thumb shape][1]][1]
Aizan Sagheer
  • 349
  • 3
  • 8
  • what do you mean by *"parent class is accepting color from child"* ? – pskink May 30 '21 at 08:34
  • I mean property of Parent(SliderTheme) thumbColor is not working, you can check above code, this thumbColor is overriden by property of Child(Slider) activeColor – Aizan Sagheer May 30 '21 at 08:39
  • 1
    it is working, use: `thumbColor: Colors.red, activeTrackColor: Colors.orange,` inside `copyWith()` and remove `activeColor:` from `Slider` – pskink May 30 '21 at 08:44
  • i think you are looking for this : https://stackoverflow.com/a/58112299/11033305 – Why_So_Ezz May 30 '21 at 10:45

0 Answers0