table_calendar 1.2.2

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

Table Calendar #

Pub Package Awesome Flutter

Highly customizable, feature-packed Flutter Calendar with gestures, animations and multiple formats.

ImageImage
Table Calendar with custom stylesTable Calendar with Builders

Features #

  • Extensive, yet easy to use API
  • Custom Builders for true UI control
  • Interface for holidays
  • Locale support
  • Vertical autosizing
  • Beautiful animations
  • Gesture handling
  • Multiple Calendar formats
  • Multiple days of the week formats
  • Optional programmatic control
  • Nice, configurable UI out of the box

Usage #

Make sure to check out example project. For additional info please refer to API docs.

Installation #

Add to pubspec.yaml:

dependencies:
  table_calendar: ^1.2.2

Locale #

Table Calendar supports locales. To display the Calendar in desired language, use locale property. If you don't specify it, a default locale will be used.

Initialization #

Before you can use a locale, you need to initialize the i18n formatting.

This is independent of Table Calendar package, so I encourage you to do your own research.

A simple way of doing it is as follows:

  • First of all, add intl package to your pubspec.yaml file
  • Then make modifications to your main():
import 'package:intl/date_symbol_data_local.dart';

void main() {
  initializeDateFormatting().then((_) => runApp(MyApp()));
}

After those two steps your app should be ready to use Table Calendar with different languages.

Specifying a language #

To specify a language, simply pass it as a String code to locale property.

For example, this will make Table Calendar use Polish language:

TableCalendar(
  locale: 'pl_PL',
),
ImageImageImageImage
'en_US''pl_PL''fr_FR''zh_CN'

Note, that if you want to change the language of FormatButton's text, you have to do this yourself. Use availableCalendarFormats property and pass the translated Strings there. Use i18n method of your choice.

You can also hide the button altogether by setting formatButtonVisible to false.

Holidays #

Table Calendar provides a simple interface for displaying holidays. Here are a few steps to follow:

  • Fetch a map of holidays tied to dates. You can search for it manually, or perhaps use some online API
  • Convert it to a proper format - note that these are lists of holidays, since one date could have a couple of holidays:
{
  `DateTime A`: [`Holiday A1`, `Holiday A2`, ...],
  `DateTime B`: [`Holiday B1`, `Holiday B2`, ...],
  ...
}
  • Link it to Table Calendar. Use holidays property

And that's your basic setup! Now you can add some styling:

  • By using CalendarStyle properties: holidayStyle and outsideHolidayStyle
  • By using CalendarBuilders for complete UI control over calendar cell

You can also add custom holiday markers thanks to improved marker API. Check out example project for more details.

markersBuilder: (context, date, events, holidays) {
  final children = <Widget>[];

  if (events.isNotEmpty) {
    children.add(
      Positioned(
        right: 1,
        bottom: 1,
        child: _buildEventsMarker(date, events),
      ),
    );
  }

  if (holidays.isNotEmpty) {
    children.add(
      Positioned(
        right: -2,
        top: -2,
        child: _buildHolidaysMarker(),
      ),
    );
  }

  return children;
},

[1.2.2]

  • Fixed issue with Markers being null

[1.2.1]

  • RowHeight can now be set as a fixed value
  • MaxMarkersAmount will now affect MarkersBuilder

[1.2.0]

  • Added holiday support
  • Added holiday usage guide
  • Improved custom markers builder
  • Added rendering priority customization
  • Added FormatButton behavior customization

[1.1.4]

  • Added TextBuilders for Header and DOW panel
  • Improved vertical swipe behavior

[1.1.3]

  • Added title text customization with format skeleton
  • Added day of the week text customization with format skeleton
  • Rolled-back intl dependency

[1.1.2]

  • Added locale support
  • Added locale usage guide
  • Updated example project

[1.1.1]

  • Improved chevron customization

[1.1.0]

  • Added programmatic selectedDay
  • Removed onFormatChanged callback - it is now integrated into onVisibleDaysChanged callback
  • Improved onVisibleDaysChanged behavior
  • Fixed issue with empty Calendar row
  • Changed default FormatButton texts
  • Updated example project

[1.0.2]

  • FormatButton text can now be customized

[1.0.1]

  • Fixed CalendarFormat issue when not using a callback

[1.0.0]

  • Added custom Builders API
  • Added DateTime truncation logic
  • onDaySelected callback now contains list of events associated with that day
  • Added onVisibleDaysChanged callback
  • SwipeConfig can now be customized
  • Days outside of current month can be shown/hidden
  • Refactored code
  • Updated example project

[0.3.2]

  • Added SwipeToExpand for CalendarFormat
  • AvailableGestures can now be specified (none, horizontalSwipe, verticalSwipe, all)
  • Fixed styling issue with SelectedDay on weekends

[0.3.1]

  • Added slide animation for CalendarFormat
  • CalendarFormat animation can now be specified (slide, scale)
  • Added Monday-Sunday week format
  • Week format can now be specified with StartingDayOfWeek enum

[0.3.0]

  • Any style can now be customized
  • Grouped properties into Classes
  • Refactored code for better readability
  • Added full documentation

[0.2.2]

  • Added optional initial Date (defaults to DateTime.now())

[0.2.1]

  • Added animated Swipe gesture
  • CalendarFormat can now be enforced programmatically

[0.2.0]

  • Added animations to CalendarFormat change
  • Added animations to Date selection
  • Added new CalendarFormat - TwoWeeks
  • Available CalendarFormats can now be specified

[0.1.4]

  • Refactored code
  • Updated example project

[0.1.3]

  • Added chevron button customization
  • Calendar header can be hidden now

[0.1.2]

  • Added OnFormatChanged callback

[0.1.1]

  • Added CalendarFormat button customization

[0.1.0]

  • Added CalendarFormat button - toggle between month view and week view
  • Additional customization is now available

[0.0.2]

  • Revamped example
  • Improved description

[0.0.1] - Initial release

  • Fully working TableCalendar; example included

example/README.md

Table Calendar example #

Demonstrates how to use table_calendar package. Displays Table Calendar widget with a ListView underneath it.

ImageImage
Table Calendar with custom stylesTable Calendar with Builders

Table Calendar offers a lot of customization:

  • by using custom Styles
  • by using custom Builders (accompanied by custom Styles)

Using just Styles is a great way to get nice results with little effort. That being said, using Builders will give you full control over Calendar's UI.

This example project will show you both of aforementioned methods.

For more info please refer to API docs.

Use this package as a library

1. Depend on it

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


dependencies:
  table_calendar: ^1.2.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:table_calendar/table_calendar.dart';
  
Version Uploaded Documentation Archive
1.2.2 May 24, 2019 Go to the documentation of table_calendar 1.2.2 Download table_calendar 1.2.2 archive
1.2.1 May 18, 2019 Go to the documentation of table_calendar 1.2.1 Download table_calendar 1.2.1 archive
1.2.0 Apr 27, 2019 Go to the documentation of table_calendar 1.2.0 Download table_calendar 1.2.0 archive
1.1.4 Apr 4, 2019 Go to the documentation of table_calendar 1.1.4 Download table_calendar 1.1.4 archive
1.1.3 Apr 3, 2019 Go to the documentation of table_calendar 1.1.3 Download table_calendar 1.1.3 archive
1.1.2 Apr 2, 2019 Go to the documentation of table_calendar 1.1.2 Download table_calendar 1.1.2 archive
1.1.1 Mar 30, 2019 Go to the documentation of table_calendar 1.1.1 Download table_calendar 1.1.1 archive
1.1.0 Mar 26, 2019 Go to the documentation of table_calendar 1.1.0 Download table_calendar 1.1.0 archive
1.0.2 Mar 22, 2019 Go to the documentation of table_calendar 1.0.2 Download table_calendar 1.0.2 archive
1.0.1 Mar 21, 2019 Go to the documentation of table_calendar 1.0.1 Download table_calendar 1.0.1 archive

All 24 versions...

Popularity:
Describes how popular the package is relative to other packages. [more]
94
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
95
Overall:
Weighted score of the above. [more]
96
Learn more about scoring.

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

  • Dart: 2.3.2
  • pana: 0.12.18
  • Flutter: 1.5.4-hotfix.2

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Format lib/src/customization/calendar_builders.dart.

Run flutter format to format lib/src/customization/calendar_builders.dart.

Format lib/src/customization/calendar_style.dart.

Run flutter format to format lib/src/customization/calendar_style.dart.

Format lib/src/customization/days_of_week_style.dart.

Run flutter format to format lib/src/customization/days_of_week_style.dart.

Fix additional 4 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/src/customization/header_style.dart (Run flutter format to format lib/src/customization/header_style.dart.)
  • lib/src/logic/calendar_logic.dart (Run flutter format to format lib/src/logic/calendar_logic.dart.)
  • lib/src/widgets/cell_widget.dart (Run flutter format to format lib/src/widgets/cell_widget.dart.)
  • lib/table_calendar.dart (Run flutter format to format lib/table_calendar.dart.)

Maintenance issues and suggestions

Support latest dependencies. (-5 points)

The version constraint in pubspec.yaml does not support the latest published versions for 1 dependency.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
date_utils ^0.1.0+2 0.1.0+2
flutter 0.0.0
intl ^0.15.7 0.15.8
simple_gesture_detector ^0.1.3 0.1.3
Transitive dependencies
collection 1.14.11
meta 1.1.6 1.1.7
path 1.6.2
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test