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.
class MyAppState extends State<MyApp> {
CalendarController _calendarController = CalendarController();
@override
initState() {
_calendarController.selectedDate = DateTime(2022, 02, 05);
_calendarController.displayDate = DateTime(2022, 02, 05);
super.initState();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text('Calendar Demo'),
actions: <Widget>[
IconButton(
icon: Icon(Icons.arrow_forward),
onPressed: () {
_calendarController.forward!();
},
),
],
leading: IconButton(
icon: Icon(Icons.arrow_back),
onPressed: () {
_calendarController.backward!();
},
),
),
body: SfCalendar(
view: CalendarView.month,
controller: _calendarController,
),
),
);
}
}
Implementation
VoidCallback? backward;