In the Flutter Date Range Picker, Confirm or Cancel the selected date or date ranges by enabling the showActionsButtons. If it is cancelled, onCancel method is called but if it is confirmed, the onSubmit method is called. Customize the action button’s text by using cancelText and confirmText property. The code snippet for picker with range selection mode is attached below. In the same way showActionsButtons can be used for other views. child: SfDateRangePicker( view: DateRangePickerView.month, selectionMode: DateRangePickerSelectionMode.range, showActionButtons: true, cancelText: 'CANCEL', confirmText: 'OK', onCancel: () { ScaffoldMessenger.of(context).showSnackBar(const SnackBar( content: Text( 'Selection Cancelled', ), duration: Duration(milliseconds: 500), )); }, onSubmit: (Object value) { ScaffoldMessenger.of(context).showSnackBar(const SnackBar( content: Text( 'Selection Confirmed', ), duration: Duration(milliseconds: 500), )); }, ), |
This page will automatically be redirected to the sign-in page in 10 seconds.