calendarro 0.0.2

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

Calendarro

Calendar widget library for Flutter apps. Offers multiple ways to customize the widget.

Getting Started

Installation

Add dependency to your pubspec.yaml:

calendarro: ^0.0.1

Basic use

First, add an import to your code:

import 'package:calendarro/calendarro.dart';

Add a widget to your code:

Calendarro(
  startDate: DateUtils.getFirstDayOfCurrentMonth(),
  endDate: DateUtils.getLastDayOfCurrentMonth()
  )

alt tag

Customization

alt tag

<b>1. Display Mode</b> - If you prefer to operate on multiple rows to see whole month, use:

Calendarro(
  displayMode: DisplayMode.MONTHS,
  ...
  )

<b>2. Selection Mode</b> - If you want to select multiple dates, use:

Calendarro(
  selectionMode: SelectionMode.MULTI,
  ...
  )

<b>3. Weekday Labels</b> - If you want to provide your own row widget for displaying weekday names, use:

Calendarro(
  weekdayLabelsRow: CustomWeekdayLabelsRow()
  ...
  )

you can create your CustomWeekdayLabelsRow by looking at default CalendarroWeekdayLabelsView.

<b>4. Day Tile Builder</b> - If you want to build day tiles your own way, you can use:

Calendarro(
  dayTileBuilder: CustomDayTileBuilder()
  ...
  )

you can create your CustomDayTileBuilder looking upon DefaultDayTileBuilder.

<b>5. Initial selected dates</b> - When you want some dates to be selected from the scratch, use selectedDate (SelectionMode.SINGLE) or selectedDates (SelectionMode.MULTI) arguments:

Calendarro(
  selectedDate: DateTime(2018, 8, 1)
  //or
  selectedDates: [DateTime(2018, 8, 1), DateTime(2018, 8, 8)]
  ...
  )

you can create your CustomDayTileBuilder looking upon DefaultDayTileBuilder.

Selecting date callback

If you want to ignite some callbacks when selecting dates for now I suggest implementing Custom Day Tile Builder with GestureDetector and passing events through some EventBus (e.g. https://pub.dartlang.org/packages/event_bus)

Advanced usage:

For more advanced usage see: https://github.com/adamstyrc/parking-app

[0.0.1] - TODO: Add release date.

  • TODO: Describe initial release.

example/lib/main.dart

import 'package:calendarro/date_utils.dart';
import 'package:flutter/material.dart';
import 'package:calendarro/calendarro.dart';

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      title: 'Calendarro Demo',
      theme: new ThemeData(
        primarySwatch: Colors.orange,
      ),
      home: new MyHomePage(title: 'Calendarro Demo'),
    );
  }
}

class MyHomePage extends StatelessWidget {
  final String title;

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

  @override
  Widget build(BuildContext context) {
    var lastDayOfNextMonth = DateUtils.getLastDayOfNextMonth();
    return new Scaffold(
      appBar: new AppBar(
        title: new Text(title),
      ),
      body: Column(
        children: <Widget>[
          Container(
            color: Colors.orange,
            child: Calendarro(),
          ),
          Container(height: 32.0),
          Calendarro(
            startDate: DateUtils.getFirstDayOfCurrentMonth(),
            endDate: lastDayOfNextMonth,
            displayMode: DisplayMode.MONTHS,
            selectionMode: SelectionMode.MULTI,
            weekdayLabelsRow: CustomWeekdayLabelsRow(),
          )
        ],
      ),
    );
  }
}


class CustomWeekdayLabelsRow extends StatelessWidget {

  @override
  Widget build(BuildContext context) {
    return Row(
      children: <Widget>[
        Expanded(child: Text("M", textAlign: TextAlign.center)),
        Expanded(child: Text("T", textAlign: TextAlign.center)),
        Expanded(child: Text("W", textAlign: TextAlign.center)),
        Expanded(child: Text("T", textAlign: TextAlign.center)),
        Expanded(child: Text("F", textAlign: TextAlign.center)),
        Expanded(child: Text("S", textAlign: TextAlign.center)),
        Expanded(child: Text("S", textAlign: TextAlign.center)),
      ],
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  calendarro: ^0.0.2

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:calendarro/calendarro.dart';
  
Version Uploaded Documentation Archive
0.0.2 Sep 3, 2018 Go to the documentation of calendarro 0.0.2 Download calendarro 0.0.2 archive
0.0.1 Aug 7, 2018 Go to the documentation of calendarro 0.0.1 Download calendarro 0.0.1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
75
Health:
Code health derived from static analysis. [more]
98
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
70
Overall:
Weighted score of the above. [more]
81
Learn more about scoring.

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

  • Dart: 2.0.0
  • pana: 0.12.4
  • Flutter: 0.9.5

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Fix lib/calendarro.dart. (-1 points)

Analysis of lib/calendarro.dart reported 2 hints:

line 16 col 7: This class inherits from a class marked as @immutable, and therefore should be immutable (all instance fields must be final).

line 90 col 30: The operator x ~/ y is more efficient than (x / y).toInt().

Fix lib/calendarro_page.dart. (-1 points)

Analysis of lib/calendarro_page.dart reported 2 hints:

line 3 col 8: Unused import: 'package:calendarro/default_weekday_labels_row.dart'.

line 6 col 7: This class inherits from a class marked as @immutable, and therefore should be immutable (all instance fields must be final).

Fix lib/default_day_tile.dart. (-0.50 points)

Analysis of lib/default_day_tile.dart reported 1 hint:

line 5 col 7: This class inherits from a class marked as @immutable, and therefore should be immutable (all instance fields must be final).

Fix additional 3 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/date_utils.dart (Run flutter format to format lib/date_utils.dart.)
  • lib/default_day_tile_builder.dart (Run flutter format to format lib/default_day_tile_builder.dart.)
  • lib/default_weekday_labels_row.dart (Run flutter format to format lib/default_weekday_labels_row.dart.)

Maintenance suggestions

The description is too short. (-20 points)

Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

Package is pre-v0.1 release. (-10 points)

While there is nothing inherently wrong with versions of 0.0.*, it usually means that the author is still experimenting with the general direction of the API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >1.19.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11
meta 1.1.6
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test