forward property
Moves to the next view programmatically with animation by checking that the next view dates falls between the minimum and maximum date range.
Note: If the current view has the maximum date range, it will not move to the next view.
See also:
- SfDateRangePicker.showNavigationArrow, which allows to display the navigation arrows on the header view of the date range picker.
- backward, which used to navigate to the previous 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? forward;