CalendarDateRangePicker constructor
CalendarDateRangePicker({
- Key? key,
- NepaliDateTime? initialStartDate,
- NepaliDateTime? initialEndDate,
- required NepaliDateTime firstDate,
- required NepaliDateTime lastDate,
- NepaliDateTime? currentDate,
- required ValueChanged<
NepaliDateTime> ? onStartDateChanged, - required ValueChanged<
NepaliDateTime> ? onEndDateChanged,
Creates a calendar date range picker.
Implementation
CalendarDateRangePicker({
super.key,
NepaliDateTime? initialStartDate,
NepaliDateTime? initialEndDate,
required NepaliDateTime firstDate,
required NepaliDateTime lastDate,
NepaliDateTime? currentDate,
required this.onStartDateChanged,
required this.onEndDateChanged,
}) : initialStartDate =
initialStartDate != null ? utils.dateOnly(initialStartDate) : null,
initialEndDate =
initialEndDate != null ? utils.dateOnly(initialEndDate) : null,
firstDate = utils.dateOnly(firstDate),
lastDate = utils.dateOnly(lastDate),
currentDate = utils.dateOnly(currentDate ?? NepaliDateTime.now()) {
if (initialStartDate != null &&
initialEndDate != null &&
initialStartDate.isAfter(initialEndDate)) {
final temp = initialStartDate;
initialStartDate = initialEndDate;
initialEndDate = temp;
}
assert(
initialStartDate == null ||
initialEndDate == null ||
!initialStartDate.isAfter(initialEndDate),
'initialStartDate must be on or before initialEndDate.');
assert(!lastDate.isBefore(firstDate),
'firstDate must be on or before lastDate.');
}