When setState is called within a parent widget of the ScrollWheelDatePicker widget, the DateController is reinitialized, leading to the override of the current DateTime and an unsynced UI. This issue arises, for instance, when setState is invoked inside the onSelectedItemChanged callback. Consequently, the widget undergoes partial rebuilding, triggering a new initialization of the DateController.
/// initialDate = 1.1.1990
/// For example, if the date is initially set to 1.1.1990 and the year is increased by one, the resulting date should be 1.1.1991.
onSelectedItemChanged: (date) {
setState(() {
_myDateVariable = date;
});
print(date);
},
/// However, if we subsequently change the day (or month in this case) by incrementing it by one, the date becomes 1.2.1990 instead of 1.2.1991.
Additional Changes:
Removed the default text color to allow the utilization of the default color from the app theme.
When setState is called within a parent widget of the ScrollWheelDatePicker widget, the DateController is reinitialized, leading to the override of the current DateTime and an unsynced UI. This issue arises, for instance, when setState is invoked inside the onSelectedItemChanged callback. Consequently, the widget undergoes partial rebuilding, triggering a new initialization of the DateController.
Additional Changes:
Removed the default text color to allow the utilization of the default color from the app theme.