Articles in this section
Category / Section

How to customize the cell border in the Flutter Calendar?

1 min read

In the Flutter Event Calendar, you can customize the cell borders by using the cellBorderColor property of the calendar. By using the cellBorderColor property, you can customize the vertical and horizontal line colors.

child: SfCalendar(
  view: CalendarView.day,
  allowedViews: <CalendarView>[
    CalendarView.day,
    CalendarView.week,
    CalendarView.workWeek,
    CalendarView.month,
    CalendarView.timelineDay,
    CalendarView.timelineWeek,
    CalendarView.timelineWorkWeek,
    CalendarView.timelineMonth,
  ],
  cellBorderColor: Colors.teal,
),

View sample in GitHub

Flutter calendar cell border

 

Conclusion

I hope you enjoyed learning about how to customize the cell border 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 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 (3)
Please  to leave a comment
MD
Maria Donosova

Hello Syncfusion team, is there a way to change color only for a specified border of a particular cell?

IR
Indumathi Ravichandran

Hi Maria,

Thank you for contacting Syncfusion support.

Based on the shared information, we have checked and your requirement is “Change the particular cell border color in the Flutter Calendar” and your requirement can be achieved by using monthCellBuilder(For month view) and timeRegionBuilder(other calendar views) properties of the Flutter Calendar. We have prepared the simple sample for the same.

Please find the sample from the following link.

Sample link: https://www.syncfusion.com/downloads/support/directtrac/general/ze/flutter_builder_(1)-68113491.zip

Code snippet:

child: SfCalendar(
  allowedViews: const [CalendarView.day,CalendarView.week,CalendarView.workWeek,CalendarView.month],
  view: CalendarView.month,
  monthCellBuilder: monthCellBuilder,
  timeRegionBuilder: timeregionBuilder,
  specialRegions: _getTimeRegions(),
),

Widget monthCellBuilder(BuildContext context, MonthCellDetails details) {
  if (details.date.day == DateTime.now().day) {
    return Container(
      decoration: BoxDecoration(
        border: Border.all(
          color: Colors.green,
          width: 2,
        ),
        borderRadius: BorderRadius.circular(1),
      ),
      child: Text(details.date.day.toString()),
    );
  }
  return Container(
    decoration: BoxDecoration(
      border: Border.all(
        color: Colors.red,
        width: 1,
      ),
      borderRadius: BorderRadius.circular(1),
    ),
    child: Text(details.date.day.toString()),
  );
}

Widget timeregionBuilder(BuildContext context, TimeRegionDetails timeRegionDetails) 
  return Container(
    decoration: BoxDecoration(
      border: Border.all(
        color: Colors.green,
        width: 2,
      ),
      borderRadius: BorderRadius.circular(1),
    ),
  );
}

Also please find the UG documentation for the same.

UG links: https://help.syncfusion.com/flutter/calendar/builders#month-cell-builder https://help.syncfusion.com/flutter/calendar/builders#time-region-builder

Also please find the KB documentations for the same, https://www.syncfusion.com/kb/12192/how-to-customize-the-special-time-region-using-custom-builder-in-the-flutter-calendar

We hope that this helps you. Please let us know if you need further assistance.

Regards, Indumathi R

DS
Diego Silva Silvino

Hello Syncfusion team, is there a way to change the cell color of the current or specific week?

Access denied
Access denied