calendar_widget 0.1.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 64

calendar_widget #

A flutter package for a simple but customizable month view calendar widget.

Getting Started #

For installation information see here

Properties #

RequiredNameTypeDefault Value
NohighlighterCalendarHighlighterno highlighting
Yeswidthdouble
Noheightdoublecalculated based on width
NoonTapListenerTapListener
NohighlightColorColortheme accent color

Example #

See folder example/ for an example of usage.

calendar usage example

[0.1.0] - 1/16/2019 #

  • added ability to allow for scrolling to the future

[0.0.6] - 1/5/2019 #

  • updated license

[0.0.5] - 1/5/2019 #

  • added recording of usage example

[0.0.4] - 1/5/2019 #

  • added example

[0.0.3] - 1/5/2019 #

  • removed log statements

[0.0.2] - 1/5/2019 #

  • Added license information

[0.0.1] - 1/5/2019 #

  • First release! Everything should be working as described. Will upload more detailed README in the future

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:calendar_widget/calendar_widget.dart';
import 'dart:math';

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

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Calendar Widget Example',
      theme: 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 simply save your changes to "hot reload" in a Flutter IDE).
        // Notice that the counter didn't reset back to zero; the application
        // is not restarted.
        primarySwatch: Colors.blue,
      ),
      home: Scaffold(
        appBar: AppBar(
          title: Text('Calendar Widget Example'),
        ),
        body: MyHomePage(),
      )
    );
  }
}

class MyHomePage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    CalendarHighlighter highlighter = (DateTime dt) {
      // randomly generate a boolean list of length monthLength + 1 (because months start at 1)
      return List.generate(Calendar.monthLength(dt) + 1, (index) {
        return (Random().nextDouble() < 0.3);
      });
    };

    return Container(
      margin: EdgeInsets.only(top: 16),
      alignment: Alignment.topCenter,
      child: Calendar(
        width: MediaQuery.of(context).size.width - 32,
        onTapListener: (DateTime dt) {
          final snackbar = SnackBar(content: Text('Clicked ${dt.month}/${dt.day}/${dt.year}!'),);
          Scaffold.of(context).showSnackBar(snackbar);
        },
        highlighter: highlighter,
      ),
    );
  }

}

Use this package as a library

1. Depend on it

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


dependencies:
  calendar_widget: ^0.1.0

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

We analyzed this package on Jul 3, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.13
  • Flutter: 1.17.5

Analysis suggestions

Package not compatible with SDK dart

because of import path [calendar_widget] that is in a package requiring null.

Health suggestions

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

Analysis of lib/calendar_widget.dart reported 3 hints:

line 42 col 51: 'headline' is deprecated and shouldn't be used. This is the term used in the 2014 version of material design. The modern term is headline5. This feature was deprecated after v1.13.8..

line 48 col 51: 'body1' is deprecated and shouldn't be used. This is the term used in the 2014 version of material design. The modern term is bodyText2. This feature was deprecated after v1.13.8..

line 200 col 16: 'headline' is deprecated and shouldn't be used. This is the term used in the 2014 version of material design. The modern term is headline5. This feature was deprecated after v1.13.8..

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).

Package is getting outdated. (-45.75 points)

The package was last published 76 weeks ago.

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.1
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8
path 1.7.0
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8
Dev dependencies
flutter_test