backward property
Moves to the previous view programmatically with animation by checking that the previous view dates falls between the minimum and maximum date range.
Note: If the current view has the minimum date range, it will not move to the previous view.
See also:
- SfDateRangePicker.showNavigationArrow, which allows to display the navigation arrows on the header view of the date range picker.
- forward, which used to navigate to the next view of the date range picker programmatically.
- SfDateRangePicker.onViewChanged, the callback which notifies when the current view visible date changed on the date range picker.
- Knowledge base: How to do programmatic navigation
- Knowledge base: How to programmatically navigate to adjacent dates
- Knowledge base: How to programmatically navigate
class MyApp extends StatefulWidget {
@override
MyAppState createState() => MyAppState();
}
class MyAppState extends State<MyApp> {
DateRangePickerController _pickerController = DateRangePickerController();
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
actions: <Widget>[
IconButton(
icon: Icon(Icons.arrow_forward),
onPressed: () {
_pickerController.forward!();
},
)
],
title: Text('Date Range Picker Demo'),
leading: IconButton(
icon: Icon(Icons.arrow_back),
onPressed: () {
_pickerController.backward!();
},
),
),
body: SfDateRangePicker(
controller: _pickerController,
view: DateRangePickerView.month,
selectionMode: DateRangePickerSelectionMode.single,
),
),
);
}
}
Implementation
VoidCallback? backward;