flutter_calendar_carousel 1.1.1

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • new86

flutter_calendar_carousel

Calendar widget for flutter that is swipeable horizontally. This widget can help you build your own calendar widget highly customizable.

pub version

Rectangular style

Circular style

No border

Marked Dates

Getting Started

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

Props

propstypesdefaultValues
weekDays['Sun', 'Mon', 'Tue', 'Wed', 'Thur', 'Fri', 'Sat']
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
headerTextTextText('${DateFormat.yMMM().format(this._dates[1])}')
weekendTextStyleTextStylefontSize: 14.0, color: Colors.pinkAccent
markedDatesList<DateTime[]
markedDateColorColorColors.blueAccent
markedDateWidgetColorPositioned(child: Container(color: Colors.blueAccent, height: 4.0, width: 4.0), bottom: 4.0, left: 18.0);
headerMarginEdgetInsetsconst EdgeInsets.symmetric(vertical: 16.0)
childAspectRatiodouble1.0
weekDayMarginEdgeInsetsconst EdgeInsets.only(bottom: 4.0)

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(
      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
//          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'),
//          ),
    ),
  );
}

TODO

  • [x] Render weekdays.
  • [x] Customizable headerWidget.
  • [x] Set weekdays visibility.
  • [x] Customizable textStyles for days in weekend.
  • [x] Marked Dates.
  • [ ] 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/><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>

[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/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_calendar_carousel/flutter_calendar_carousel.dart' show CalendarCarousel;

void main() => runApp(new MyApp());

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      title: 'dooboolab flutter calendar',
      theme: new ThemeData(
        // This is the theme of your application.
        //
        // Try running your application with "flutter run". You'll see the
        // application has a blue toolbar. Then, without quitting the app, try
        // changing the primarySwatch below to Colors.green and then invoke
        // "hot reload" (press "r" in the console where you ran "flutter run",
        // or press Run > Flutter Hot Reload in IntelliJ). Notice that the
        // counter didn't reset back to zero; the application is not restarted.
        primarySwatch: Colors.blue,
      ),
      home: new MyHomePage(title: 'Flutter Calendar Carousel Exmaple'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  // This widget is the home page of your application. It is stateful, meaning
  // that it has a State object (defined below) that contains fields that affect
  // how it looks.

  // This class is the configuration for the state. It holds the values (in this
  // case the title) provided by the parent (in this case the App widget) and
  // used by the build method of the State. Fields in a Widget subclass are
  // always marked "final".

  final String title;

  @override
  _MyHomePageState createState() => new _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  DateTime _currentDate = DateTime(2018, 8, 1);
  List<DateTime> _markedDate = [DateTime(2018, 9, 20), DateTime(2018, 10, 11)];

  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar(
        title: new Text(widget.title),
      ),
      body: Container(
        margin: EdgeInsets.symmetric(horizontal: 16.0),
        child: CalendarCarousel(
          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,
          height: 420.0,
          selectedDateTime: _currentDate,
          daysHaveCircularBorder: false, /// null for not rendering any border, true for circular border, false for rectangular border
        ),
      ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  flutter_calendar_carousel: ^1.1.1

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter packages get

Alternatively, your editor might support flutter packages 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';
  
Version Uploaded Documentation Archive
1.1.1 Sep 18, 2018 Go to the documentation of flutter_calendar_carousel 1.1.1 Download flutter_calendar_carousel 1.1.1 archive
1.1.0 Sep 16, 2018 Go to the documentation of flutter_calendar_carousel 1.1.0 Download flutter_calendar_carousel 1.1.0 archive
1.0.3 Sep 14, 2018 Go to the documentation of flutter_calendar_carousel 1.0.3 Download flutter_calendar_carousel 1.0.3 archive
1.0.2 Sep 12, 2018 Go to the documentation of flutter_calendar_carousel 1.0.2 Download flutter_calendar_carousel 1.0.2 archive
1.0.1 Sep 11, 2018 Go to the documentation of flutter_calendar_carousel 1.0.1 Download flutter_calendar_carousel 1.0.1 archive
1.0.0 Sep 11, 2018 Go to the documentation of flutter_calendar_carousel 1.0.0 Download flutter_calendar_carousel 1.0.0 archive
0.2.1 Sep 11, 2018 Go to the documentation of flutter_calendar_carousel 0.2.1 Download flutter_calendar_carousel 0.2.1 archive
0.2.0 Sep 11, 2018 Go to the documentation of flutter_calendar_carousel 0.2.0 Download flutter_calendar_carousel 0.2.0 archive
0.1.5 Sep 11, 2018 Go to the documentation of flutter_calendar_carousel 0.1.5 Download flutter_calendar_carousel 0.1.5 archive
0.1.4 Sep 10, 2018 Go to the documentation of flutter_calendar_carousel 0.1.4 Download flutter_calendar_carousel 0.1.4 archive

All 14 versions...

Popularity:
Describes how popular the package is relative to other packages. [more]
72
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]
86
Learn more about scoring.

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

  • Dart: 2.0.0
  • pana: 0.12.3
  • Flutter: 0.8.4

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Suggestions

Fix lib/flutter_calendar_carousel.dart.

Analysis of lib/flutter_calendar_carousel.dart reported 1 hint:

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

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
flutter 0.0.0
intl ^0.15.7 0.15.7
Transitive dependencies
collection 1.14.11
meta 1.1.6
path 1.6.2
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test