flutter_calendar_carousel 1.3.18

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.

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
markedDatesList<DateTime>[]
markedDatesMapEventsnull
markedDateColorColorColors.blueAccent
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
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

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) {
        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'),
//      ),
//      markedDates: _markedDate,
      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.
  • [ ] 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

[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.3.18

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]
96
Health:
Code health derived from static analysis. [more]
97
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
97
Learn more about scoring.

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

  • Dart: 2.4.0
  • pana: 0.12.19
  • Flutter: 1.7.8+hotfix.4

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health issues and suggestions

Document public APIs. (-0.68 points)

91 out of 92 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Fix lib/flutter_calendar_carousel.dart. (-1.49 points)

Analysis of lib/flutter_calendar_carousel.dart reported 3 hints:

line 107 col 22: 'markedDates' is deprecated and shouldn't be used.

line 109 col 22: 'markedDateColor' is deprecated and shouldn't be used.

line 326 col 29: The value of the local variable 'textStyle' isn't used.

Fix lib/classes/event.dart. (-0.50 points)

Analysis of lib/classes/event.dart reported 1 hint:

line 11 col 17: Override hashCode if overriding ==.

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
date_utils ^0.1.0 0.1.0+2
flutter 0.0.0
intl ^0.15.7 0.15.8
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.6 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