Articles in this section
Category / Section

How to customize the month cell based on the appointment using builder in the Flutter Calendar

1 min read

In the Flutter Event Calendar, you can customize the month cell based on appointments by using the monthCellBuilder property of the calendar.

STEP 1: Use the required widget for cell customization. Here Text widget used to customize the month cell. MonthCellDetails returns the details (date, appointments, visibleDates, bounds) about the cell. Using this, you can get the appointment details of the cell.

Widget monthCellBuildesr(BuildContext context, MonthCellDetails details) {
 
  if (details.appointments.isNotEmpty) {
    Appointment appointment=details.appointments[0];
    return Container(
      color: appointment.color,
      child: Text(appointment.subject),
    );
  }
  return Container(
    color: Colors.blueGrey,
    child: Text(details.date.day.toString()),
  );
}

STEP 2: Assign the widget to the monthCellBuilder property of the Flutter event calendar.

child: SfCalendar(
  view: CalendarView.month,
  monthCellBuilder: monthCellBuilder,
  dataSource: _getCalendarDataSource(),
)

View the GitHub sample here

Appointment cell customization

 

Conclusion

I hope you enjoyed learning about how to customize the month cell based on the appointment using 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 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