MarkedDatePickerDialog constructor

MarkedDatePickerDialog({
  1. Key? key,
  2. required DateTime initialDate,
  3. required DateTime firstDate,
  4. required DateTime lastDate,
  5. DateTime? currentDate,
  6. DatePickerEntryMode initialEntryMode = DatePickerEntryMode.calendar,
  7. SelectableDayPredicate? selectableDayPredicate,
  8. String? cancelText,
  9. String? confirmText,
  10. String? helpText,
  11. DatePickerMode initialCalendarMode = DatePickerMode.day,
  12. String? errorFormatText,
  13. String? errorInvalidText,
  14. String? fieldHintText,
  15. String? fieldLabelText,
  16. String? restorationId,
  17. ValueListenable<List<DateTime>>? markedDatesListenable,
  18. UpdateMonthCallback? updateMonthCallback,
  19. Widget? marking,
  20. Color? todayColor,
  21. Color? markedColor,
  22. Color? selectedDayColor,
  23. Color? selectedDayBackground,
})

A Material-style date picker dialog.

Implementation

MarkedDatePickerDialog({
  Key? key,
  required DateTime initialDate,
  required DateTime firstDate,
  required DateTime lastDate,
  DateTime? currentDate,
  this.initialEntryMode = DatePickerEntryMode.calendar,
  this.selectableDayPredicate,
  this.cancelText,
  this.confirmText,
  this.helpText,
  this.initialCalendarMode = DatePickerMode.day,
  this.errorFormatText,
  this.errorInvalidText,
  this.fieldHintText,
  this.fieldLabelText,
  this.restorationId,
  this.markedDatesListenable,
  this.updateMonthCallback,
  this.marking,
  this.todayColor,
  this.markedColor,
  this.selectedDayColor,
  this.selectedDayBackground,
})  : initialDate = DateUtils.dateOnly(initialDate),
      firstDate = DateUtils.dateOnly(firstDate),
      lastDate = DateUtils.dateOnly(lastDate),
      currentDate = DateUtils.dateOnly(currentDate ?? DateTime.now()),
      super(key: key) {
  assert(
    !this.lastDate.isBefore(this.firstDate),
    'lastDate ${this.lastDate} must be on or after firstDate ${this.firstDate}.',
  );
  assert(
    !this.initialDate.isBefore(this.firstDate),
    'initialDate ${this.initialDate} must be on or after firstDate ${this.firstDate}.',
  );
  assert(
    !this.initialDate.isAfter(this.lastDate),
    'initialDate ${this.initialDate} must be on or before lastDate ${this.lastDate}.',
  );
  assert(
    selectableDayPredicate == null ||
        selectableDayPredicate!(this.initialDate),
    'Provided initialDate ${this.initialDate} must satisfy provided selectableDayPredicate',
  );
}