CalendarDateRangePicker constructor
CalendarDateRangePicker({
- Key? key,
- DateTime? initialStartDate,
- DateTime? initialEndDate,
- required DateTime firstDate,
- required DateTime lastDate,
- DateTime? currentDate,
- required ValueChanged<
DateTime> ? onStartDateChanged, - required ValueChanged<
DateTime?> ? onEndDateChanged,
Creates a scrollable calendar grid for picking date ranges.
Implementation
CalendarDateRangePicker({
Key? key,
DateTime? initialStartDate,
DateTime? initialEndDate,
required DateTime firstDate,
required DateTime lastDate,
DateTime? currentDate,
required this.onStartDateChanged,
required this.onEndDateChanged,
}) : initialStartDate = initialStartDate != null ? DateUtils.dateOnly(initialStartDate) : null,
initialEndDate = initialEndDate != null ? DateUtils.dateOnly(initialEndDate) : null,
assert(firstDate != null),
assert(lastDate != null),
firstDate = DateUtils.dateOnly(firstDate),
lastDate = DateUtils.dateOnly(lastDate),
currentDate = DateUtils.dateOnly(currentDate ?? DateTime.now()),
super(key: key) {
assert(
this.initialStartDate == null || this.initialEndDate == null || !this.initialStartDate!.isAfter(initialEndDate!),
'initialStartDate must be on or before initialEndDate.',
);
assert(
!this.lastDate.isBefore(this.firstDate),
'firstDate must be on or before lastDate.',
);
}