flutter_calendar_carousel 1.4.2

  • Readme
  • Changelog
  • Example
  • Installing
  • 98

flutter_calendar_carousel #

Pub Version Build Status License Coverage Status

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.

New Feature #

  • Check out great feature customDayBuilder work done by maxgmer 🎉.

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
markedDateWidgetColorPositioned(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

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 #

  • [x] Render weekdays.
  • [x] Customizable headerWidget.
  • [x] Set weekdays visibility.
  • [x] Customizable textStyles for days in weekend.
  • [x] Marked Dates.
  • [x] Multiple Marked Dates.
  • [x] Customizable weekend days.
  • [x] Week Calendar.
  • [x] Carousel Week Calendar.
  • [ ] Multiple days selections.
  • [x] Widget test.

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/> Buy Me A Coffee Paypal

[1.4.1]

[1.4.0]

[1.3.29]

[1.3.28]

  • Allow the use of generic type with Interface #149
  • Added doc to custom weekday builder. Weekday number is now supplied to the builder #150

[1.3.27]

  • customDayBuilder fix.
  • Remove date_utils dep.

[1.3.26]

  • Support custom day container feature #145.

[1.3.23]

  • Support intl >= 0.15.7 < 0.17.0 to inclease pub health
  • Removed deprecated methods markedDates, markedDateColor
  • Fixes #101
  • Fixes #104
  • Fixes #112
  • Fixes #119
  • Support long pressed as a feature request#103
  • Support semantic label as a feature request #139
  • Expose dayCrossAxisAlignment and dayMainAxisAlignment to resolve #122
  • Expose showIconBehindDayText to resolve #131
  • Fixes #94

[1.3.20]

  • Support intl >= 0.15.7

[1.3.19]

  • Improved customizability for weekday containers #141

[1.3.18]

  • Fix vertical scroll behavior for weekFormat calendar view.
  • Reformat code with dartfmt

[1.3.17]

  • Added feature to only show dates from today adding showOnlyCurrentMonthDate parameter.

[1.3.16]

  • Added feature for change first day of the week.

[1.3.15+]

  • Ability to disable horizontal scroll to change month with isScrollable param.
  • Show events in week calendar.
  • Update breaking docs in pub.
  • Expose event list to user.
  • Remove print.
  • Pass first date of week to onCalendarChanged in week view #88
  • Support for passing in custom widgets for next and previous month arrow icons #95

[1.3.14]

  • Code refactoring #77
    • Seperate weekday widget

[1.3.13]

  • Code refactoring #73
    • Seperate header.
    • Add first basic test code.
    • Add composable header widget

[1.3.12]

  • Setting dot icon per event #71

[1.3.11]

  • Fixed selectledDayTextStyle property not being respected #65.

[1.3.10]

  • Add property for static six week format to keep calendar height consistent between months #62.

[1.3.9]

  • Changed priority for today higher than prevMonth and nextMonth and thisMonth.

[1.3.7]

  • Ability to choose the weekday format on the constructor #47.

[1.3.6]

  • custom event type added #49.

[1.3.5]

  • headerTitleTouchable and onHeaderTitlePressed props added #44.

[1.3.4]

  • Bug fix. PrevDaysTextStyle and PrevDaysTextStyle overwrite weekendTextStyle #41.

[1.3.3]

  • Fixed FlatButton fill and border color. #37
  • EventList bug fixing. #37

[1.3.2]

  • Mapping events for better performance. #34.

[1.3.1]

  • weekdays bug fix.

[1.3.0]

  • Better localization support for weekDays. Setting manually weekdays isn't required now. Related #23.
  • Add custom icons in event #28.

[1.2.3]

  • Add custom physics parameter. Feature in #21.

[1.2.2]

  • headerTextStyle fix#17.
  • Can show or hide header button with showHeaderButton attribute.

[1.2.1]

  • Week-format shows current week #15.

[1.2.0]

  • Support carousel week calendar.

[1.1.11]

  • Ability to customize weekend days #13.

[1.1.10]

  • Support weekFormat but without carousel.

[1.1.9]

  • Updated readme.

[1.1.8]

  • Render multiple marked dates.
  • markedDates is deprecated. Use markedDatesMap instead.

[1.1.3]

  • Mark dates with non-zero times.

[1.1.2]

  • Implemented a way to change the header text style.

[1.1.1]

  • Expose new variables.
    • headerMargin, childAspectRatio, weekDayMargin

[1.1.0]

  • Give proper text color in weekend when it is today.
  • Compare month and year for marking today's date. Resolve #3.

[1.0.3]

  • Fixed pub broken image.

[1.0.2]

  • Use Position widget to mark the dates.

[1.0.1]

  • Show markedDates.

[0.2.0]

  • Customizable headerWidget.
  • Setting weekdays visibility
  • Customizable weekend color.

[0.1.3]

  • Rename the top-level "docs" directory to "doc".

[0.1.1]

  • Added readme.

[0.1.0]

  • First release

example/README.md

flutter_calendar_carousel #

import 'package:flutter_calendar_carousel/flutter_calendar_carousel.dart' show CalendarCarousel;
Widget widget() {
  return Container(
    margin: EdgeInsets.symmetric(horizontal: 16.0),
    child: CalendarCarousel(
      current: DateTime.now(),
      onDayPressed: (DateTime date) {
        this.setState(() => _currentDate = date);
      },
      thisMonthDayBorderColor: Colors.grey,
      height: 420.0,
      selectedDateTime: _currentDate,
      daysHaveCircularBorder: false, /// null for not rendering any border, true for circular border, false for rectangular border
      markedDatesMap: _markedDateMap,
//          weekendStyle: TextStyle(
//            color: Colors.red,
//          ),
//          weekDays: null, /// for pass null when you do not want to render weekDays
//          headerText: Container( /// Example for rendering custom header
//            child: Text('Custom Header'),
//          ),
    ),
  );
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  flutter_calendar_carousel: ^1.4.2

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:flutter_calendar_carousel/flutter_calendar_carousel.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
97
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
98
Learn more about scoring.

We analyzed this package on Oct 18, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.1
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.4

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Format lib/flutter_calendar_carousel.dart.

Run flutter format to format lib/flutter_calendar_carousel.dart.

Format lib/src/calendar_header.dart.

Run flutter format to format lib/src/calendar_header.dart.

Format lib/src/default_styles.dart.

Run flutter format to format lib/src/default_styles.dart.

Format lib/src/weekday_row.dart.

Run flutter format to format lib/src/weekday_row.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
flutter 0.0.0
intl >=0.1.0 <0.17.0 0.16.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.7
path 1.6.4
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test