calendar_flutter 1.1.5

  • Readme
  • Changelog
  • Example
  • Installing
  • 80

flutter_calendar #

A new Flutter package project for displaying calendar and the events that are happening currently.

Getting Started #

Add the flutter_calendar dependency to your pubspec.yaml

Add it as a child to any Widget, send size to the widget, by default it occupies the screen width and height

Set the list of events by using static method setListAndUpdateMap present in CalendarEvent class in calender_event.dart file

To add the calendar widget you just need to add below line of code

CustomCalendar() as a child

Example:

Container(
  child:CustomCalendar(),
);

Then you will see the UI as below:

If you want to add the events, you need to first set the list of events then build the widget which has CustomCalendar as child(this can be found in example):

void setCalendarEvents(){
    List<CalendarEvent> eventsList = List<CalendarEvent>();

    CalendarEvent event = CalendarEvent();
    event.title = "Meeting";
    event.startTime = DateTime(2019,11,01);
    event.endTime = DateTime(2019,11,10);
    event.bgColor = Colors.redAccent;
    eventsList.add(event);

    event = CalendarEvent();
    event.title = "Meeting1";
    event.startTime = DateTime(2019,11,09);
    event.endTime = DateTime(2019,11,09);
    event.bgColor = Colors.redAccent;
    eventsList.add(event);

    event = CalendarEvent();
    event.title = "Meeting2";
    event.startTime = DateTime(2019,11,10);
    event.endTime = DateTime(2019,11,10);
    event.bgColor = Colors.redAccent;
    eventsList.add(event);

    event = CalendarEvent();
    event.title = "Meeting3";
    event.startTime = DateTime(2019,11,01);
    event.endTime = DateTime(2019,11,10);
    event.bgColor = Colors.redAccent;
    eventsList.add(event);

    event = CalendarEvent();
    event.title = "Meeting2";
    event.startTime = DateTime(2019,11,06);
    event.endTime = DateTime(2019,11,15);
    eventsList.add(event);
    CalendarEvent.setListAndUpdateMap(eventsList);
  }

UI with events would look like:

[1.1.5] - 03-11-2019 #

  • Support for showing custom background color for events
  • New UI for showing count if the number of events in the day exceed the count that can be displayed.

[1.0.5] - 02-07-2019. #

  • Formatted files
  • decreased font size of day names and color change
  • bug fixes in Calendar Event

[1.0.0] - 02-07-2019. #

  • A Simple calendar UI that occupies given width and height.
  • Shows the list of events on the calendar itself
  • Displays events as bars passing through dates for ranged events

example/lib/main.dart

import 'package:calendar_flutter/calendar_event.dart';
import 'package:calendar_flutter/flutter_calendar.dart';
import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key}) : super(key: key);

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

class _MyHomePageState extends State<MyHomePage> {
  

  @override
  Widget build(BuildContext context) {
    //setCalendarEvents();// uncomment this to see the events on the calendar
    return Scaffold(
      appBar: AppBar(
        title: Text('Calendar'),
      ),
      body:CustomCalendar()
    );
  }

  void setCalendarEvents(){
    List<CalendarEvent> eventsList = List<CalendarEvent>();

    CalendarEvent event = CalendarEvent();
    event.title = "Meeting";
    event.startTime = DateTime(2019,07,01);
    event.endTime = DateTime(2019,07,10);
    eventsList.add(event);

    event = CalendarEvent();
    event.title = "Meeting2";
    event.startTime = DateTime(2019,07,06);
    event.endTime = DateTime(2019,07,15);
    eventsList.add(event);
    CalendarEvent.setListAndUpdateMap(eventsList);
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  calendar_flutter: ^1.1.5

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_flutter/calendar_flutter.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
61
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]
80
Learn more about scoring.

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

  • Dart: 2.7.1
  • pana: 0.13.6
  • Flutter: 1.12.13+hotfix.8

Health suggestions

Format lib/calendar_event.dart.

Run flutter format to format lib/calendar_event.dart.

Format lib/month_view.dart.

Run flutter format to format lib/month_view.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.2.2 <3.0.0
auto_size_text ^2.0.1 2.1.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test