single static method

MonthPicker<DateTime> single({
  1. Key? key,
  2. required DateTime selectedDate,
  3. required ValueChanged<DateTime> onChanged,
  4. required DateTime firstDate,
  5. required DateTime lastDate,
  6. DatePickerLayoutSettings datePickerLayoutSettings = const DatePickerLayoutSettings(),
  7. DatePickerStyles? datePickerStyles,
  8. DatePickerKeys? datePickerKeys,
  9. SelectableDayPredicate? selectableDayPredicate,
  10. ValueChanged<DateTime>? onMonthChanged,
})

Creates a month picker where only one single month can be selected.

See also:

Implementation

static MonthPicker<DateTime> single(
    {Key? key,
    required DateTime selectedDate,
    required ValueChanged<DateTime> onChanged,
    required DateTime firstDate,
    required DateTime lastDate,
    DatePickerLayoutSettings datePickerLayoutSettings =
        const DatePickerLayoutSettings(),
    DatePickerStyles? datePickerStyles,
    DatePickerKeys? datePickerKeys,
    SelectableDayPredicate? selectableDayPredicate,
    ValueChanged<DateTime>? onMonthChanged}) {
  assert(!firstDate.isAfter(lastDate));
  assert(!lastDate.isBefore(firstDate));
  assert(!selectedDate.isBefore(firstDate));
  assert(!selectedDate.isAfter(lastDate));

  final selection = MonthPickerSingleSelection(selectedDate);
  final selectionLogic = MonthSelectable(selectedDate, firstDate, lastDate,
      selectableDayPredicate: selectableDayPredicate);

  return MonthPicker<DateTime>._(
    onChanged: onChanged,
    firstDate: firstDate,
    lastDate: lastDate,
    selectionLogic: selectionLogic,
    selection: selection,
    datePickerKeys: datePickerKeys,
    datePickerStyles: datePickerStyles ?? DatePickerRangeStyles(),
    datePickerLayoutSettings: datePickerLayoutSettings,
  );
}