onCancel property
Called whenever the cancel button tapped on date range picker. It reset the selected values to confirmed selected values.
See also:
- showActionButtons, which allows to display action buttons at the bottom of the date range picker to handle the selection.
- onSelectionChanged, callback which notifies whenever the selection changed on date range picker.
- cancelText, which is text that display on the cancel button.
- confirmText, which is text that display on the confirm button
- onSubmit, callback which notifies when the selection confirmed through the ok 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: SfDateRangePicker(
showActionButtons: true,
onCancel: () {
Navigator.pop(context);
},
)));
}
Implementation
final VoidCallback? onCancel;