onViewChanged property
Called when the current visible view or visible date range changes.
The visible date range and the visible view which visible on view when the view changes available in the DateRangePickerViewChangedArgs.
See also:
- onSelectionChanged, callback which notifies whenever the selection changed on date range picker.
- onSubmit, callback which notifies when the selection confirmed through the ok button of showActionButtons.
- onCancel, callback which notifies when the selection canceled through the cancel button of showActionButtons.
- DateRangePickerViewChangedArgs, which contains the visible date range details of the current visible view.
- initialDisplayDate, which is used to navigate the date range picker to specific date on initially.
- DateRangePickerController.displayDate, which allows to move the date range picker to specific date.
- DateRangePickerController.forward, which allows to navigate to next view of the date range picker programmatically.
- DateRangePickerController.backward, which allows to navigate to previous view of the date range picker programmatically.
- Knowledge base: How to update blackout dates using onViewChanged callback
- Knowledge base: How to customize the header in flutter multi date range picker
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: SfDateRangePicker(
view: DateRangePickerView.month,
selectionMode: DateRangePickerSelectionMode.multiple,
showNavigationArrow: true,
onViewChanged: (DateRangePickerViewChangedArgs args) {
final PickerDateRange _visibleDateRange = args.visibleDateRange;
final DateRangePickerView _visibleView = args.view;
},
),
),
);
}
Implementation
final DateRangePickerViewChangedCallback? onViewChanged;