Home

Awesome

flutter_calendar_carousel

Pub Version Flutter CI Coverage Status License

Calendar widget for flutter that is swipeable horizontally. This widget can help you build your own calendar widget highly customizable. Now you can even add your icon for each event.

Notice

This widget is compatible with flutter V3 from version 2.4.+.

New Feature

[2.0.3]

Rectangular style

image

Circular style

image

No border

image

Marked Dates

image

Custom Icon Events

image

Getting Started

For help getting started with Flutter, view our online documentation.

Props

propstypesdefaultValues
viewPortFractiondouble1.0
prevDaysTextStyleTextStyle
daysTextStyleTextStyle
nextDaysTextStyleTextStyle
prevMonthDayBorderColorColorColors.transparent
thisMonthDayBorderColorColorColors.transparent
nextMonthDayBorderColorColorColors.transparent
dayPaddingdouble2.0
heightdoubledouble.infinity
widthdoubledouble.infinity
todayTextStyleTextStylefontSize: 14.0, color: Colors.white
dayButtonColorColorColors.red
todayBorderColorColorColors.red
todayButtonColorColorsColors.red
selectedDateTimeDateTime
selectedDayTextStyleTextStylefontSize: 14.0, color: Colors.white
selectedDayBorderColorColorColors.green
selectedDayButtonColorColorColors.green
daysHaveCircularBorderbool
onDayPressedFunc
weekdayTextStyleTextStylefontSize: 14.0, color: Colors.deepOrange
iconColorColorColors.blueAccent
headerTextStyleTextStylefontSize: 20.0, color: Colors.blue
headerTextTextText('${DateFormat.yMMM().format(this._dates[1])}')
weekendTextStyleTextStylefontSize: 14.0, color: Colors.pinkAccent
markedDatesMapEventsnull
markedDateWidgetWidgetPositioned(child: Container(color: Colors.blueAccent, height: 4.0, width: 4.0), bottom: 4.0, left: 18.0);
markedDateShowIconboolfalse
markedDateIconBorderColorColor
markedDateIconMaxShownint2
markedDateIconMargindouble5.0
markedDateIconBuilderMarkedDateIconBuilder<T>
markedDateIconOffsetdouble5.0
markedDateCustomShapeBorderShapeBordernull
markedDateCustomTextStyleTextStylenull
markedDateMoreCustomDecorationDecoration
markedDateMoreCustomTextStyleTextStyle
headerMarginEdgetInsetsconst EdgeInsets.symmetric(vertical: 16.0)
headerTitleTouchableboolfalse
onHeaderTitlePressedFunction() => _selectDateFromPicker()
showHeaderbool
showHeaderButtonbool
childAspectRatiodouble1.0
weekDayMarginEdgeInsetsconst EdgeInsets.only(bottom: 4.0)
weekFormatboolfalse
localeStringen
firstDayOfWeekintnull
onCalendarChangedFunction(DateTime)
minSelectedDateDateTime
maxSelectedDateDateTime
inactiveDaysTextStyleTextStyle
inactiveWeekendTextStyleTextStyle
weekDayFormatWeekdayFormatshort
staticSixWeekFormatboolfalse
showOnlyCurrentMonthDateboolfalse
dayCrossAxisAlignmentCrossAxisAlignmentCrossAxisAlignment.center
dayMainAxisAlignmentMainAxisAlignmentCrossAlignment.center
showIconBehindDayTextboolfalse
pageScrollPhysicsScrollPhysicsScrollPhysics

With CalendarCarousel<YourEventClass> and EventList<YourEventClass> you can specifiy a custom Event class.

Install

Add flutter_calendar_carousel as a dependency in pubspec.yaml For help on adding as a dependency, view the documentation.

Usage

import 'package:flutter_calendar_carousel/flutter_calendar_carousel.dart' show CalendarCarousel;
Widget widget() {
  return Container(
    margin: EdgeInsets.symmetric(horizontal: 16.0),
    child: CalendarCarousel<Event>(
      onDayPressed: (DateTime date, List<Event> events) {
        this.setState(() => _currentDate = date);
      },
      weekendTextStyle: TextStyle(
        color: Colors.red,
      ),
      thisMonthDayBorderColor: Colors.grey,
//      weekDays: null, /// for pass null when you do not want to render weekDays
//      headerText: Container( /// Example for rendering custom header
//        child: Text('Custom Header'),
//      ),
      customDayBuilder: (   /// you can provide your own build function to make custom day containers
        bool isSelectable,
        int index,
        bool isSelectedDay,
        bool isToday,
        bool isPrevMonthDay,
        TextStyle textStyle,
        bool isNextMonthDay,
        bool isThisMonthDay,
        DateTime day,
      ) {
          /// If you return null, [CalendarCarousel] will build container for current [day] with default function.
          /// This way you can build custom containers for specific days only, leaving rest as default.

          // Example: every 15th of month, we have a flight, we can place an icon in the container like that:
          if (day.day == 15) {
            return Center(
              child: Icon(Icons.local_airport),
            );
          } else {
            return null;
          }
      },
      weekFormat: false,
      markedDatesMap: _markedDateMap,
      height: 420.0,
      selectedDateTime: _currentDate,
      daysHaveCircularBorder: false, /// null for not rendering any border, true for circular border, false for rectangular border
    ),
  );
}

TODO

Help Maintenance

I've been maintaining quite many repos these days and burning out slowly. If you could help me cheer up, buying me a cup of coffee will make my life really happy and get much energy out of it. <br/> <a href="https://www.buymeacoffee.com/dooboolab" target="_blank"><img src="https://www.buymeacoffee.com/assets/img/custom_images/purple_img.png" alt="Buy Me A Coffee" style="height: auto !important;width: auto !important;" ></a> Paypal