calendarDateRangePickerBuilder function

TransitionBuilder calendarDateRangePickerBuilder(
  1. CalendarDelegate<DateTime> calendarDelegate, {
  2. TransitionBuilder? builder,
})

Keeps calendarDelegate on the dialog created by showDateRangePicker.

Flutter 3.32 omits the delegate when constructing DateRangePickerDialog. Supply this as the picker's builder, along with the same calendarDelegate argument. Locale, text direction, dialog options, and an optional application builder are preserved. Newer Flutter versions already preserve the delegate and their dialog is passed through unchanged.

Implementation

TransitionBuilder calendarDateRangePickerBuilder(
  CalendarDelegate<DateTime> calendarDelegate, {
  TransitionBuilder? builder,
}) {
  return (context, child) {
    final dialog = _withCalendarDelegate(child!, calendarDelegate);
    return builder == null ? dialog : builder(context, dialog);
  };
}