0

How can we allow only selection of 30 days with any start date in DateRangePicker?

Only firstDate and lastDate can be provided, which can be restricted to 30 days starting from the provided firstDate only.

iqfareez
  • 555
  • 7
  • 21

2 Answers2

1

Add below package to restrict certain dates in DateRangePicker

calendar_date_picker2: ^0.5.2

there is "selectableDayPredicate" function available for DateRangePicker.

You can simply pass list of dates which you wants to disable in selection in range.

Hardik Hirpara
  • 2,594
  • 20
  • 34
0
final picked = await showDateRangePicker(
  context: context,
  firstDate: (DateTime.now()).subtract(Duration(days: 30)),
  lastDate: DateTime.now(),
  currentDate: DateTime.now(),
  saveText: 'Done',
);
My Car
  • 4,198
  • 5
  • 17
  • 50
Sachin Kumawat
  • 297
  • 1
  • 7