single static method
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,
Creates a month picker where only one single month can be selected.
See also:
- MonthPicker.multi - month picker where many single months can be selected.
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,
);
}