Hi jaewhi,
Thank you for contacting Syncfusion support.
Regarding Query: (select maximum 31 days from the start date after notifying the user with - eg. popup). Is there an example or functionality for this?
Yes, it is possible to popup when selected range exceeds the specified count by calculating the difference between startDate and endDate of the selected range. We have attached the code snippet for the same.
Code snippet:
|
child: SfDateRangePicker( onSelectionChanged: selectionChanged, selectionMode: DateRangePickerSelectionMode.range, monthViewSettings: DateRangePickerMonthViewSettings( showTrailingAndLeadingDates: true), )),
void selectionChanged(DateRangePickerSelectionChangedArgs args) {
if (args.value is PickerDateRange) {
DateTime start = args.value.startDate;
DateTime end = args.value.endDate;
int difference = end.difference(start).inDays;
if (difference > 31) {
_showDialog();
}
}
}
void _showDialog() {
showDialog(
builder: (context) => new AlertDialog(
title: Container(
child: Text("Selected range exceeds 31"),
),
contentPadding: const EdgeInsets.all(16.0),
actions: <Widget>[
new TextButton(
child: const Text('OK'),
onPressed: () {
Navigator.pop(context);
})
],
),
context: context,
);
} |
Screenshot:
Also, we have a property minDate and maxDate for date restriction. Please find the UG document from the following link.
UG link:
We hope that this helps you. Please let us know if you need further assistance.
Regards,
Indumathi R