Articles in this section
Category / Section

How to do programmatic navigation using Flutter Calendar

2 mins read

In the Flutter Event Calendar, you can programmatically navigate to the calendar view using view property of the CalendarController.

Inside initState(), initialize the controller for the calendar.

final CalendarController _controller = CalendarController();

Use the view property the calendar controller inside the RaisedButton pressed callback.

  margin: const EdgeInsets.fromLTRB(50, 30, 50, 0),
  child: RaisedButton(
    child: Text('Change view'),
    onPressed: () {
      _controller.view = CalendarView.timelineWeek;

Assign controller value to the controller property of the calendar.

child: SfCalendar(
  view: CalendarView.workWeek,
  controller: _controller,

View sample in GitHub

Flutter calendar view navigation




Did you find this information helpful?
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment