How to customize appointments using custom builder in the Flutter Calendar?
In the Flutter Event Calendar, you can add the custom builder for appointments by using the appointmentBuilder property of the calendar.
STEP 1: You can use any widget for appointment builder. Here we are using Text and Icon widget for customization.
Widget appointmentBuilder(BuildContext context, CalendarAppointmentDetails calendarAppointmentDetails) { final Appointment appointment = calendarAppointmentDetails.appointments.first; return Column( children: [ Container( width: calendarAppointmentDetails.bounds.width, height: calendarAppointmentDetails.bounds.height / 2, color: appointment.color, child: Center( child: Icon( Icons.group, color: Colors.black, ), )), Container( width: calendarAppointmentDetails.bounds.width, height: calendarAppointmentDetails.bounds.height / 2, color: appointment.color, child: Text( appointment.subject + DateFormat(' (hh:mm a').format(appointment.startTime) + '-' + DateFormat('hh:mm a)').format(appointment.endTime), textAlign: TextAlign.center,style: TextStyle(fontSize: 10), ), ) ], ); }
STEP 2: Assign that widget to the appointmentBuilder property of the calendar.
child: SfCalendar( view: CalendarView.week, allowedViews: <CalendarView>[ CalendarView.day, CalendarView.workWeek, CalendarView.week, CalendarView.month, CalendarView.timelineDay, CalendarView.timelineWeek, CalendarView.timelineWorkWeek, CalendarView.timelineMonth, CalendarView.schedule ], dataSource: _getCalendarDataSource(), monthViewSettings: MonthViewSettings(showAgenda: true), timeSlotViewSettings: TimeSlotViewSettings(timelineAppointmentHeight: 100), appointmentBuilder: appointmentBuilder, )),
Conclusion
I hope you enjoyed learning about how to customize the appointments using custom builder in the Flutter Calendar.
You can refer to our Flutter Calender feature tour page to know about its other groundbreaking feature representations. You can also explore our Flutter Calendar 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!