Custom painter Does not change when the listview tile changes

Viewed 116

Currently implementing the custom slider based on the thermostats in the room, but the problem is when I change the above tile in the listview the custom painter does not repaint the slider with the selected temperature. Added the image that will give the view Sample Image

Below is the git repository: https://github.com/sagaracharya24/SampleApp.git

Let me know if any wrong I am doing , I think it is kind of small change but I am not getting it.

1 Answers

The actual issue is createState() is not called from CustomSlider when you update the values, for that you have to pass a unique key when creating CustomSlider

child: new CustomSlider(
        key: UniqueKey(),
        leftValue: autoCoolingValue,
        rightValue: autoHeatingValue,
      )

A similar question is answered here.

NB: Also, autoCoolingValue and autoHeatingValue values should be updated within setState(), hope you know that drill.

Related