Date Restrictions in Flutter Date Range Picker (SfDateRangePicker)

Minimum display date

The minDate will restrict backward date navigations features, and cannot swipe the control using the touch gesture beyond the min date range in all views.

@override
Widget build(BuildContext context) {
    return Scaffold(
       body: SfDateRangePicker(
      view: DateRangePickerView.month,
      minDate: DateTime(2020, 03, 05, 10 , 0, 0),
     )
  );
}

Maximum display date

The maxDate will restrict forward date navigations features, and cannot swipe the control using the touch gesture beyond the max date range in all views.

@override
Widget build(BuildContext context) {
    return Scaffold(
       body: SfDateRangePicker(
       view: DateRangePickerView.month,
       maxDate: DateTime(2020, 03, 25, 10 , 0, 0),
       )
   );
}

Min_Max Date Date Range Picker

Enable and disable past dates

The DateRangePicker allows you to enable or disable the past dates from today’s date in MonthView. This can be achieved by changing the enablePastDates property. By default, the value of this property is set to true.

@override
Widget build(BuildContext context) {
    return Scaffold(
       body: SfDateRangePicker(
       view: DateRangePickerView.month,
       enablePastDates : false,
     )
   );
}

Enable and disable past dates Range Picker

Blackout Dates

In DateRangePicker, blackoutDates refer to the disabled dates that restrict the user from selecting it. These dates will be marked with Strikethrough.

@override
Widget build(BuildContext context) {
    return Scaffold(
       body: SfDateRangePicker(
       view: DateRangePickerView.year,
       monthViewSettings: DateRangePickerMonthViewSettings(blackoutDates:List<DateTime>()
                ..add(DateTime(2020, 03, 18))..add(DateTime(2020, 03, 19))),
       )
   );
}