Closed psygo closed 4 years ago
I'm leaning more and more on blaming the interaction of setState
and notifyListeners
. After wrapping the Container
from the DatePickerTimeline
widget source code and replacing widget.currentDate
by a Consumer<>
with data.currentDate
(and adding notifyListeners
), everything seems to work fine.
I am not sure why this is happening. onDateChange is called after data has been changed which should change the background to respective date.
This seems to be working fine make sure you are implementing it correctly.
Describe the bug
Whenever the user changes the calendar date, something should happen in my program. At least a class I created to store my screen's data should change. In order to do so, I'm calling a method that changes the internal data and then calling
notifyListeners()
to update other fields. However, if I usenotifyListeners()
, the selected date on the calendar doesn't change; the data does change, but not the selected rectangle on the screen.To Reproduce
The code in my app is quite long, but I believe the following should suffice...
The
DatePickerTimeline
call:The method to update the data is something like:
Expected behavior
Why is the selected rectangle not being selected? I've also tried to refactor the code to use the
Provider
package instead ofsetState()
but it didn't work either.Desktop (please complete the following information):
Smartphone (please complete the following information):