Articles in this section
Category / Section

How to clear the appointments in month agenda view using onViewChange callback in the Flutter Calendar?

1 min read

In the Flutter Event Calendar, you can clear the selected date appointments using onViewChanged callback of the calendar.

STEP 1: Inside the state initialize the calendar controller.

final CalendarController _calendarController = CalendarController();

STEP 2:

In onViewChanged callback set the selected date value as null for clearing the selected date appointments.

void calendarViewChanged(ViewChangedDetails viewChangedDetails) {
  SchedulerBinding.instance!.addPostFrameCallback((timeStamp) {
    _calendarController.selectedDate = null;
  });
}

STEP 3: Assign _calendarController to controller property of the calendar.

child: SfCalendar(
  view: CalendarView.month,
  controller: _calendarController,
  dataSource: _getDataSource(),
  onViewChanged: calendarViewChanged,
  monthViewSettings: MonthViewSettings(showAgenda: true),
),

View sample in GitHub

agenda appointment gif

 

Conclusion

Hope you enjoyed learning about how to clear the appointments in month agenda view using onViewChange callback in the Flutter Calendar.

You can refer to our Flutter Calendar feature tour page to learn about its other groundbreaking feature representations. You can explore our documentation to understand how to present and manipulate data.

For current customers, you can check out our Angular components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our Angular Diagram and other Angular components.You can also explore our Flutter calendar example to understand how to create and manupulate data.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!


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