onSubmit property
Called whenever the confirm button tapped on date range picker. The dates or ranges that have been selected are confirmed and the selected value is available in the value argument.
See also:
- showActionButtons, which allows to display action buttons at the bottom of the hijri date range picker to handle the selection.
- onSelectionChanged, callback which notifies whenever the selection changed on hijri date range picker.
- cancelText, which is text that display on the cancel button.
- confirmText, which is text that display on the confirm button
- onCancel, callback which notifies when the selection canceled through the cancel button of showActionButtons.
- Knowledge base: How to confirm or cancel the selection
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Date Range Picker'),
),
body: Container(
child: SfHijriDateRangePicker(
showActionButtons: true,
onSubmit: (Object value) {
if (value is HijriDateRange) {
final HijriDateTime rangeStartDate = value.startDate!;
final HijriDateTime rangeEndDate = value.endDate!;
} else if (value is HijriDateTime) {
final HijriDateTime selectedDate = value;
} else if (value is List<HijriDateTime>) {
final List<HijriDateTime> selectedDates = value;
} else if (value is List<HijriDateRange>) {
final List<HijriDateRange> selectedRanges = value;
}
},
)));
}
Implementation
final Function(Object?)? onSubmit;