some_calendar 1.2.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 84

some calendar #

pub package License support

Custom calendar dialog widget for flutter with (multi select, single select, date range) mode

New Features #

  • Somecalendar without dialog are available 🎉.
  • you can set Scroll direction in Somecalendar.

Gif Somecalendar (without Dialog) #


Multi

Range

Single

Gif Somecalendar (Dialog) #


Multi

Range

Single

Requirements to run the demo #

Setup #

Add dependency to your pubspec.yaml:

some_calendar: ^{latest_version}

Basic use #

First, add an import to your code:

import 'package:some_calendar/some_calendar.dart';

Without dialog #

Single Mode, add to your code:

    Padding(
        padding: EdgeInsets.all(18),
        child: SomeCalendar(
            primaryColor: Color(0xff5833A5),
            mode: SomeMode.Single,
            scrollDirection: Axis.horizontal,
            isWithoutDialog: true,
            selectedDate: selectedDate,
            startDate: Jiffy().subtract(years: 3),
            lastDate: Jiffy().add(months: 9),
            done: (date) {
                setState(() {
                    selectedDate = date;
                    showSnackbar(selectedDate.toString());
                });
            },
        ),
    )

Multi Mode, add to your code:

    Padding(
        padding: EdgeInsets.all(18),
        child: SomeCalendar(
            primaryColor: Color(0xff5833A5),
            mode: SomeMode.Multi,
            isWithoutDialog: true,
            selectedDates: selectedDates,
            startDate: Jiffy().subtract(years: 3),
            lastDate: Jiffy().add(months: 9),
            done: (date) {
                setState(() {
                    selectedDates = date;
                    showSnackbar(selectedDates.toString());
                });
            },
        ),
    )

Range Mode, add to your code:

    Padding(
        padding: EdgeInsets.all(18),
        child: SomeCalendar(
            primaryColor: Color(0xff5833A5),
            mode: SomeMode.Range,
            isWithoutDialog: true,
            selectedDates: selectedDates,
            startDate: Jiffy().subtract(years: 3),
            lastDate: Jiffy().add(months: 9),
            done: (date) {
                setState(() {
                    selectedDates = date;
                    showSnackbar(selectedDates.toString());
                });
            },
        ),
    )

with dialog #

Single Mode, add to your code:

    showDialog(
        context: context,
        builder: (_) => SomeCalendar(
          mode: SomeMode.Single,
          isWithoutDialog: false,
          selectedDate: selectedDate,
          startDate: Jiffy().subtract(years: 3),
          lastDate: Jiffy().add(months: 9),
          done: (date) {
            setState(() {
              selectedDate = date;
              showSnackbar(selectedDate.toString());
            });
          },
        ));

Multi Mode, add to your code:

    showDialog(
        context: context,
        builder: (_) => SomeCalendar(
          mode: SomeMode.Multi,
          startDate: Jiffy().subtract(years: 3),
          lastDate: Jiffy().add(months: 9),
          isWithoutDialog: false,
          selectedDates: selectedDates,
          done: (date) {
            setState(() {
              selectedDates = date;
              showSnackbar(selectedDates.toString());
            });
          },
        ));

Range Mode, add to your code:

    showDialog(
        context: context,
        builder: (_) => SomeCalendar(
          mode: SomeMode.Range,
          startDate: Jiffy().subtract(years: 3),
          lastDate: Jiffy().add(months: 9),
          selectedDates: selectedDates,
          isWithoutDialog: false,
          primaryColor: Colors.red,
          done: (date) {
            setState(() {
              selectedDates = date;
              showSnackbar(selectedDates.toString());
            });
          },
        ));

SomeMode #

SomeMode
Range
Single
Multi

Parameters #

parametertypesdefaultValues
primaryColorcolorColor(0xff365535)
selectedDateDateDate.now()
selectedDatesDate[]Date.now() + 4 days
isWithoutDialogbooltrue
scrollDirectionAxisAxis.vertical
startDateDate
lastDateDate
modeSomeMode

Help Maintenance #

I've taken the time to make this library, help support to develop it or buy me coffee and snacks to be even more enthusiastic <br/> Buy Me A Coffee Paypal

[1.2.0] - 11 March 2020. #

  • Somecalendar without dialog are available .
  • you can set Scroll direction in Somecalendar.

[1.1.3] - 10 March 2020. #

* Fix bug selected dates are not updating

[1.1.1] - 09 March 2020. #

* You can use favorite color :tada:.
* You can support this library with buy some coffe to me :)
* Fix bug

[1.1.0] - 07 March 2020. #

* You can use favorite color :tada:.
* You can support this library with buy some coffe to me :)

[1.0.15] - 28 February 2020. #

* Readme

[1.0.14] #

* Fix Selected date function

[1.0.1] #

* Add Selected date Function
* Fix Selected date Function

[1.0.0] #

* Release first version

example/lib/main.dart

import 'package:example/main_single_without_dialog.dart';
import 'package:flutter/material.dart';
import 'package:jiffy/jiffy.dart';
import 'package:some_calendar/some_calendar.dart';

import 'main_multi_without_dialog.dart';
import 'main_range_without_dialog.dart';

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

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      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: MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

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

  final String title;

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

class _MyHomePageState extends State<MyHomePage> {
  DateTime selectedDate = DateTime.now();
  List<DateTime> selectedDates = List();
  final _scaffoldKey = GlobalKey<ScaffoldState>();

  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      key: _scaffoldKey,
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: SafeArea(
        child: Container(
          padding: EdgeInsets.all(16),
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              Center(
                child: Text(
                  'SomeCalendar Dialog',
                  style: TextStyle(fontSize: 18),
                ),
              ),
              SizedBox(
                height: 16,
              ),
              Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: <Widget>[
                  RaisedButton(
                    child: Text("Single"),
                    onPressed: () {
                      showDialog(
                          context: context,
                          builder: (_) => SomeCalendar(
                                primaryColor: Color(0xff5833A5),
                                mode: SomeMode.Single,
                                isWithoutDialog: false,
                                selectedDate: selectedDate,
                                startDate: Jiffy().subtract(years: 3),
                                lastDate: Jiffy().add(months: 9),
                                done: (date) {
                                  setState(() {
                                    selectedDate = date;
                                    showSnackbar(selectedDate.toString());
                                  });
                                },
                              ));
                    },
                  ),
                  RaisedButton(
                    child: Text("Multi"),
                    onPressed: () {
                      showDialog(
                          context: context,
                          builder: (_) => SomeCalendar(
                                mode: SomeMode.Multi,
                                startDate: Jiffy().subtract(years: 3),
                                lastDate: Jiffy().add(months: 9),
                                isWithoutDialog: false,
                                selectedDates: selectedDates,
                                done: (date) {
                                  setState(() {
                                    selectedDates = date;
                                    showSnackbar(selectedDates.toString());
                                  });
                                },
                              ));
                    },
                  ),
                  RaisedButton(
                    child: Text("Range"),
                    onPressed: () {
                      showDialog(
                          context: context,
                          builder: (_) => SomeCalendar(
                                mode: SomeMode.Range,
                                primaryColor: Color(0xff5833A5),
                                startDate: Jiffy().subtract(years: 3),
                                lastDate: Jiffy().add(months: 9),
                                selectedDates: selectedDates,
                                isWithoutDialog: false,
                                done: (date) {
                                  setState(() {
                                    selectedDates = date;
                                    showSnackbar(selectedDates.toString());
                                  });
                                },
                              ));
                    },
                  ),
                ],
              ),
              SizedBox(
                height: 16,
              ),
              Center(
                child: Text(
                  'SomeCalendar without Dialog',
                  style: TextStyle(fontSize: 18),
                ),
              ),
              SizedBox(
                height: 16,
              ),
              Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: <Widget>[
                  RaisedButton(
                    child: Text("Single "),
                    onPressed: () {
                      Navigator.push(
                        context,
                        MaterialPageRoute(
                            builder: (context) => MainSingleWithoutDialog()),
                      );
                    },
                  ),
                  RaisedButton(
                    child: Text("Multi "),
                    onPressed: () {
                      Navigator.push(
                        context,
                        MaterialPageRoute(
                            builder: (context) => MainMultiWithoutDialog()),
                      );
                    },
                  ),
                  RaisedButton(
                    child: Text("Range"),
                    onPressed: () {
                      Navigator.push(
                        context,
                        MaterialPageRoute(
                            builder: (context) => MainRangeWithoutDialog()),
                      );
                    },
                  ),
                ],
              ),
            ],
          ),
        ),
      ),
    );
  }

  void showSnackbar(String x) {
    _scaffoldKey.currentState.showSnackBar(SnackBar(
      content: Text(x),
    ));
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  some_calendar: ^1.2.1

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

We analyzed this package on Apr 7, 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

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

Analysis of lib/some_calendar.dart reported 1 hint:

line 14 col 7: This class (or a class which this class inherits from) is marked as '@immutable', but one or more of its instance fields are not final: SomeCalendar.startDate, SomeCalendar.lastDate, SomeCalendar.selectedDate, SomeCalendar.selectedDates

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.2.2 <3.0.0
flutter 0.0.0
jiffy ^3.0.0 3.0.1
Transitive dependencies
collection 1.14.11 1.14.12
intl 0.16.1
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