How to handle the appointment display mode in the Flutter Calendar?
In the Flutter Event Calendar, you can handle 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 selected value from the PopupMenuButton, you can change the display mode.
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!), ),
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 forums, Direct-Trac, or feedback portal. We are always happy to assist you!