DatePickerModel constructor
Implementation
DatePickerModel({
DateTime? currentTime,
DateTime? maxTime,
DateTime? minTime,
}) {
this.maxTime = maxTime ?? DateTime(2049, 12, 31);
this.minTime = minTime ?? DateTime(1970, 1, 1);
currentTime = currentTime ?? DateTime.now();
if (currentTime.compareTo(this.maxTime) > 0) {
currentTime = this.maxTime;
} else if (currentTime.compareTo(this.minTime) < 0) {
currentTime = this.minTime;
}
this.currentTime = currentTime;
_fillLeftLists();
_fillMiddleLists();
_fillRightLists();
int minMonth = _minMonthOfCurrentYear();
int minDay = _minDayOfCurrentMonth();
_currentLeftIndex = this.currentTime.year - this.minTime.year;
_currentMiddleIndex = this.currentTime.month - minMonth;
_currentRightIndex = this.currentTime.day - minDay;
_currentHourIndex = this.currentTime.hour;
_currentMinuteIndex = this.currentTime.minute;
}