calendar_view_widget 0.1.6

  • Readme
  • Changelog
  • Example
  • Installing
  • 68

calendar_view_widget #

About #

A Flutter widget built to display a monthly calendar with a list of daily events shown below. The widget is intended to be used to fill a full scaffold body.

Status: Under Development #

This package is under development and likely to change. The hope is not to break things, but new features may require updates to your code. Notes will be added below as breaking changes come along.

v0.1.0+ Breaking Change #

Prior to 0.1.0, the package used an id field to return the id of an event to your app after a user tap on the event list, allowing you to lookup the event in your data and proceed accordingly. With 0.1.0 and later, the event Map itself will be returned on tap. The idField parameter is no longer useful with this update, and has been removed.

v0.0.3+ Breaking Change #

Prior to 0.0.3, the package used a list of events passed in the constructor as the calendar data for display. The widget has moved to a stream based list of events. This will allow for dynamic updates of events that is hopefully flexible enough to fit with your use case. The example shows a simple stream in use.

Usage Details #

CalendarView #

new CalendarView(
  eventStream: eventList, // Stream<List<Map<String, String>>>
  onEventTapped: onEventTappedHandler, // function(eventID)
  titleField: 'name', // String
  detailField: 'location', // String
  dateField: 'date', // String
  separatorTitle: 'Events', // String
  theme: ThemeData.light(), // ThemeData
),

The calendar expects a stream of Events, as described below, in addition to some other configuration values. A list of events added to the stream will replace the existing list of events in the calendar.

The example above includes the default values for the String parameters (titleField, detailField, dateField, and separatorTitle) as well as the default theme, ThemeData.light(). All of these may be overridden to suit your data structure and styling needs.

The onEventTapped handler should be a function that recieves an event Map. It can then be used to respond as needed in the rest of the app.

Example:

void onEventTapped(Map<String, String> event) {
  print(event);
}

Events #

Structure:

{
  'name': 'Event Name',
  'location': 'Event Location',
  'date': '2018-01-23 04:56:00',
}

Events are simply Maps with String keys and String values (Map<String, String>).

Null values in the titleField or detailField will be left empty in the event list. Events with null or empty values (as determined by String.isEmpty()) in the datefield will be hidden from the calendar.

Parameter Notes #

The expectation is that there are at least 3 fields to use for the display: titleField, detailField, and dateField.

Date Field Note: Inside the package, the date field is read using DateTime.parse(), so the date field string should use one of the range of formats it can ready.

Theming #

The calendar allows for a ThemeData object to be passed to it to enable theming to match the rest of your app.

Fields used in ThemeData:

primaryColor,
accentColor,
canvasColor,
backgroundColor,
dividerColor,
textTheme: {
  display1,
  subhead,
  headline,
  title
},
accentTextTheme: {
  body1,
  title,
  display1
}

Dependencies #

  • intl - provides the date formatting for display in the events list.

Special Thanks #

This package could not have been built without the awesomeness of Dart and Flutter. Thank you to the teams of people who have built the tools and infrastructure that enables this new app development ecosystem to grow and thrive.

0.0.1 #

  • Initial Release

example/README.md

example #

A new Flutter project.

Getting Started #

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

Use this package as a library

1. Depend on it

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


dependencies:
  calendar_view_widget: ^0.1.6

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:calendar_view_widget/calendar_view_widget.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
74
Health:
Code health derived from static analysis. [more]
56
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
74
Overall:
Weighted score of the above. [more]
68
Learn more about scoring.

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

  • Dart: 2.6.1
  • pana: 0.13.1+4
  • Flutter: 1.12.13+hotfix.2

Health issues and suggestions

Fix lib/src/monthView.dart. (-43.75 points)

Analysis of lib/src/monthView.dart failed with 2 errors:

line 2 col 8: Target of URI doesn't exist: 'package:quiver/time.dart'.

line 94 col 28: The method 'daysInMonth' isn't defined for the class 'MonthView'.

Format lib/src/constants.dart.

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

Maintenance issues and suggestions

Support latest dependencies. (-10 points)

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

The package description is too short. (-16 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

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.8 0.16.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.8
path 1.6.4
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test