CalendarDateRangePicker constructor

CalendarDateRangePicker({
  1. Key? key,
  2. NepaliDateTime? initialStartDate,
  3. NepaliDateTime? initialEndDate,
  4. required NepaliDateTime firstDate,
  5. required NepaliDateTime lastDate,
  6. NepaliDateTime? currentDate,
  7. required ValueChanged<NepaliDateTime>? onStartDateChanged,
  8. required ValueChanged<NepaliDateTime>? onEndDateChanged,
})

Creates a scrollable calendar grid for picking date ranges.

Implementation

CalendarDateRangePicker({
  Key? 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()),
      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.');
}