We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to customize the special dates using builder in the Flutter Date Range Picker

You can customize the specialDates cell by using cellBuilder in the Flutter date picker.

In initState(), set the default values for picker with special dates.

late List<DateTime> _specialDates;
void initState() {
  _specialDates = <DateTime>[
    DateTime.now().add(Duration(days: 2)),
    DateTime.now().add(Duration(days: 3)),
    DateTime.now().add(Duration(days: 6)),
    DateTime.now().add(Duration(days: 7)),
    DateTime.now().add(Duration(days: -2)),
    DateTime.now().add(Duration(days: -3)),
    DateTime.now().add(Duration(days: -6)),
    DateTime.now().add(Duration(days: -7))

_specialDates assigned to specialDates property of the DateRangePickerMonthViewSettings.

child: SfDateRangePicker(
  selectionMode: DateRangePickerSelectionMode.single,
      DateRangePickerMonthViewSettings(specialDates: _specialDates),
  cellBuilder: cellBuilder,

isSpecialDate checks whether the visible date is special date or not, if it is special date then show that cell with Text with Icon widget.

Widget cellBuilder(BuildContext context, DateRangePickerCellDetails details) {
  DateTime _visibleDates = details.date;
  if (isSpecialDate(_visibleDates)) {
    return Column(
      children: [
          child: Text(
            textAlign: TextAlign.center,
          color: Colors.white,
          height: 5,
          size: 13,
          color: Colors.red,
  } else {
    return Container(
      child: Text(
        textAlign: TextAlign.center,
bool isSpecialDate(DateTime date) {
  for (int j = 0; j < _specialDates.length; j++) {
    if (date.year == _specialDates[j].year &&
        date.month == _specialDates[j].month &&
        date.day == _specialDates[j].day) {
      return true;
  return false;

View sample in GitHub

DatePicker Special dates

You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile