onChangeDate function
void
onChangeDate({})
Callback for when any dropdown changes a date Handling date conflicts
Implementation
void onChangeDate({
required DateTime currentDate,
required StreamController<DateTime> dateStreamController,
int? day,
int? month,
int? year,
}) {
if (!dateStreamController.isClosed) {
int lastDayOfMonth = getNoOfDaysInMonth(
year: year ?? currentDate.year,
month: month ?? currentDate.month,
);
day ??= currentDate.day;
if (day > lastDayOfMonth) {
day = lastDayOfMonth;
}
currentDate = currentDate.copyWith(day: day, month: month, year: year);
dateStreamController.sink.add(currentDate);
}
}