flutter_date_pickers 0.0.4

  • Readme
  • Changelog
  • Example
  • Installing
  • 91

flutter_date_pickers #

Allows to use date pickers without dialog. Provides some customizable styles for date pickers.

A set of date pickers:

  • DayPicker for one day
  • WeekPicker for whole week
  • RangePicker for random range
  • MonthPicker for month

How to style date picker #

Every date picker constructor take a style object as a parameter (if no styles passed - defaults will be used).

For single value pickers (DayPicker, MonthPicker) it is DatePickerStyles object;

For range pickers (WeekPicker, RangePickers) it is DatePickerRangeStyles object;

Customizable styles: for all date pickers

TextStyle displayedPeriodTitletitle of the date picker
TextStyle currentDateStylestyle for current date
TextStyle disabledDateStylestyle for disabled dates (before first and after last date user can pick)
TextStyle selectedDateStylestyle for selected date
BoxDecoration selectedSingleDateDecorationdecoration for selected date in case single value is selected
TextStyle defaultDateTextStylestyle for date which is neither current nor disabled nor selected

only for range date pickers (WeekPicker, RangePicker)

BoxDecoration selectedPeriodStartDecorationdecoration for the first date of the selected range
BoxDecoration selectedPeriodLastDecorationdecoration for the first date of the selected range
BoxDecoration selectedPeriodMiddleDecorationDecoration for the date of the selected range which is not first date and not end date of this range

Usage #

// Create week date picker with passed parameters
Widget buildWeekDatePicker (DateTime selectedDate, DateTime firstAllowedDate, DateTime lastAllowedDate, ValueChanged<DatePeriod> onNewSelected) {

 // add some colors to default settings
    DatePickerRangeStyles styles = DatePickerRangeStyles(
      selectedPeriodLastDecoration: BoxDecoration(
          color: Colors.red,
          borderRadius: BorderRadius.only(
              topRight: Radius.circular(10.0),
              bottomRight: Radius.circular(10.0))),
      selectedPeriodStartDecoration: BoxDecoration(
        color: Colors.green,
        borderRadius: BorderRadius.only(
            topLeft: Radius.circular(10.0), bottomLeft: Radius.circular(10.0)),
      selectedPeriodMiddleDecoration: BoxDecoration(
          color: Colors.yellow, shape: BoxShape.rectangle),
  return WeekPicker(
      selectedDate: selectedDate,
      onChanged: onNewSelected,
      firstDate: firstAllowedDate,
      lastDate: lastAllowedDate,
      datePickerStyles: styles

Example app #

Please checkout example.

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

0.0.4 #

  • Refreshed intl dependency to work with new version.


import 'package:flutter/material.dart';

import 'DatePickersWidgets/month_picker_page.dart';
import 'DatePickersWidgets/day_picker_page.dart';
import 'DatePickersWidgets/range_picker_page.dart';
import 'DatePickersWidgets/week_picker_page.dart';

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

class MyApp extends StatelessWidget {
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Date pickers demo',
      theme: ThemeData(
        primarySwatch: Colors.blueGrey,
      home: MyHomePage(title: 'flutter_date_pickers Demo'),

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

  _MyHomePageState createState() => _MyHomePageState();

class _MyHomePageState extends State<MyHomePage> with TickerProviderStateMixin {
  DateTime startOfPeriod;
  DateTime endOfPeriod;
  DateTime firstDate;
  DateTime lastDate;

  int _selectedTab;

  final List<Widget> datePickers = <Widget>[

  void initState() {

    _selectedTab = 0;

    DateTime now = DateTime.now();

    firstDate = now.subtract(Duration(days: 10));
    lastDate = now.add(Duration(minutes: 10));

    startOfPeriod = firstDate;
    endOfPeriod = lastDate;

  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(
          style: TextStyle(letterSpacing: 1.15),
      body: datePickers[_selectedTab],
      bottomNavigationBar: Theme(
        data: Theme.of(context).copyWith(
            canvasColor: Colors.blueGrey,
            textTheme: Theme.of(context).textTheme.copyWith(
                caption: TextStyle(color: Colors.white.withOpacity(0.5)))),
        child: BottomNavigationBar(
          type: BottomNavigationBarType.fixed,
          items: [
                icon: Icon(Icons.date_range), title: Text("Day")),
                icon: Icon(Icons.date_range), title: Text("Week")),
                icon: Icon(Icons.date_range), title: Text("Range")),
                icon: Icon(Icons.date_range), title: Text("Month")),
          fixedColor: Colors.yellow,
          currentIndex: _selectedTab,
          onTap: (newIndex) {
            setState(() {
              _selectedTab = newIndex;

Use this package as a library

1. Depend on it

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

  flutter_date_pickers: ^0.0.4

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

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

  • Dart: 2.6.0
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.6


Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Fix lib/src/date_picker_styles.dart. (-1 points)

Analysis of lib/src/date_picker_styles.dart reported 2 hints:

line 37 col 5: Avoid empty statements.

line 40 col 5: Avoid empty statements.

Format lib/src/day_picker.dart.

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

Maintenance suggestions

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
intl >=0.15.8 <1.0.0 0.16.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.7 1.1.8
path 1.6.4
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies