Articles in this section
Category / Section

How to handle the appointment display mode in the Flutter Calendar?

1 min read

In the Flutter Event Calendar, you can control the appointment display mode by using the appointmentDisplayMode property of MonthViewSettings.

Inside the state initialize the default values.

MonthAppointmentDisplayMode? _displayMode =
    MonthAppointmentDisplayMode.appointment;

Based on the value selected from the PopupMenuButton, the display mode can be changed.

List<String> _appointmentDisplayModes = <String>[
  'Appointment',
  'Indicator',
  'None',
];
 
PopupMenuButton<String>(
  icon: Icon(Icons.party_mode),
  itemBuilder: (BuildContext context) {
    return _appointmentDisplayModes.map((String choice) {
      return PopupMenuItem<String>(
        value: choice,
        child: Text(choice),
      );
    }).toList();
  },
  onSelected: (String value) {
    setState(() {
      if (value == 'Appointment') {
        _displayMode = MonthAppointmentDisplayMode.appointment;
      } else if (value == 'Indicator') {
        _displayMode = MonthAppointmentDisplayMode.indicator;
      } else if (value == 'None') {
        _displayMode = MonthAppointmentDisplayMode.none;
      }
    });
  },
),

Set the _displayMode value to the appointmentDisplayMode property of the calendar.

child: SfCalendar(
  view: CalendarView.month,
  dataSource: _getCalendarDataSource(),
  monthViewSettings: MonthViewSettings(
    showAgenda: true,
      appointmentDisplayMode:
         _displayMode!),
),

View the GitHub sample here

displaymodegif

 

Conclusion

I hope you enjoyed learning about how to handle the appointment display mode in the Flutter Calendar.

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

For current customers, you can check out our 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 other controls.

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  to leave a comment
Access denied
Access denied