CustomRangeDatePicker constructor
- Key? key,
- required DateTime maxDate,
- required DateTime minDate,
- ValueChanged<
DateTimeRange< ? onRangeSelected,DateTime> > - VoidCallback? onLeadingDateTap,
- ValueChanged<
DateTime> ? onStartDateChanged, - ValueChanged<
DateTime> ? onEndDateChanged, - DateTime? currentDate,
- DateTime? initialDate,
- DateTimeRange<
DateTime> ? selectedRange, - EdgeInsets padding = const EdgeInsets.all(16),
- PickerType initialPickerType = PickerType.days,
- TextStyle? daysOfTheWeekTextStyle,
- TextStyle? enabledCellsTextStyle,
- BoxDecoration enabledCellsDecoration = const BoxDecoration(),
- TextStyle? disabledCellsTextStyle,
- BoxDecoration disabledCellsDecoration = const BoxDecoration(),
- TextStyle? currentDateTextStyle,
- BoxDecoration? currentDateDecoration,
- TextStyle? selectedCellsTextStyle,
- BoxDecoration? selectedCellsDecoration,
- TextStyle? singleSelectedCellTextStyle,
- BoxDecoration? singleSelectedCellDecoration,
- TextStyle? leadingDateTextStyle,
- Color? slidersColor,
- double? slidersSize,
- Color? highlightColor,
- Color? splashColor,
- double? splashRadius,
- bool centerLeadingDate = false,
- String? previousPageSemanticLabel,
- String? nextPageSemanticLabel,
Creates a calendar range picker.
It will display a grid of days for the initialDate's month. If initialDate
is null, DateTime.now() will be used. If DateTime.now() does not fall within
the valid range of minDate and maxDate, it will fall back to the nearest
valid date from DateTime.now(), selecting the maxDate if DateTime.now() is
after the valid range, or minDate if before.
The day indicated by selectedRange will be selected if provided.
The optional onRangeSelected callback will be called if provided
when a range is selected.
The user interface provides a way to change the year and the month being
displayed. By default it will show the day grid, but this can be changed
with initialPickerType.
The minDate is the earliest allowable date. The maxDate is the latest
allowable date. initialDate and selectedRange must either fall between
these dates, or be equal to one of them.
The currentDate represents the current day (i.e. today). This
date will be highlighted in the day grid. If null, the date of
DateTime.now() will be used.
For each of these DateTime parameters, only their dates are considered. Their time fields are ignored.
Implementation
CustomRangeDatePicker({
super.key,
required this.maxDate,
required this.minDate,
this.onRangeSelected,
this.onLeadingDateTap,
this.onStartDateChanged,
this.onEndDateChanged,
this.currentDate,
this.initialDate,
this.selectedRange,
this.padding = const EdgeInsets.all(16),
this.initialPickerType = PickerType.days,
this.daysOfTheWeekTextStyle,
this.enabledCellsTextStyle,
this.enabledCellsDecoration = const BoxDecoration(),
this.disabledCellsTextStyle,
this.disabledCellsDecoration = const BoxDecoration(),
this.currentDateTextStyle,
this.currentDateDecoration,
this.selectedCellsTextStyle,
this.selectedCellsDecoration,
this.singleSelectedCellTextStyle,
this.singleSelectedCellDecoration,
this.leadingDateTextStyle,
this.slidersColor,
this.slidersSize,
this.highlightColor,
this.splashColor,
this.splashRadius,
this.centerLeadingDate = false,
this.previousPageSemanticLabel,
this.nextPageSemanticLabel,
}) {
assert(!minDate.isAfter(maxDate), "minDate can't be after maxDate");
}