The Flutter plugin that help you can choose dates and years with rounded calendars and customizable themes.

Overview

Flutter Rounded Date Picker

The Flutter plugin that help you can choose dates and years with rounded calendars and customizable themes.

Screenshot Screenshot Screenshot Screenshot

Installing

Add dependencies in pubspec.yaml file. Add 2 things in it including flutter_localizations

dependencies:
  flutter_localizations:
    sdk: flutter
  flutter_rounded_date_picker: 2.0.2

Importing

import packages into your dart.

import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:flutter_rounded_date_picker/rounded_picker.dart';

Initialize localizations

Add localization delegates in MaterialApp Widget and add languages that your app supports.

MaterialApp(
    localizationsDelegates: [
          GlobalMaterialLocalizations.delegate,
          GlobalWidgetsLocalizations.delegate,
    ],
    supportedLocales: [
          const Locale('en', 'US'), // English
          const Locale('th', 'TH'), // Thai
    ],
    ...
)

Show Date Picker

Show date picker which you can specify a date that allows users to choose.

DateTime newDateTime = await showRoundedDatePicker(
  context: context,
  initialDate: DateTime.now(),
  firstDate: DateTime(DateTime.now().year - 1),
  lastDate: DateTime(DateTime.now().year + 1),
  borderRadius: 16,
),

Screenshot Screenshot

Show Year Picker

Show year picker which you can specify a year start and end that allows users to choose.

DateTime newDateTime = await showRoundedDatePicker(
  context: context,
  initialDatePickerMode: DatePickerMode.year,
  theme: ThemeData(primarySwatch: Colors.green),
);

Screenshot

Theme

You can assign themes to the date picker by using ThemeData class and PrimarySwatch.

DateTime newDateTime = await showRoundedDatePicker(
  context: context,
  theme: ThemeData(primarySwatch: Colors.pink),
);

Screenshot

Dark theme

DateTime newDateTime = await showRoundedDatePicker(
  context: context,
  theme: ThemeData.dark(),
);

Screenshot

Custom Theme with ThemeData

DateTime newDateTime = await showRoundedDatePicker(
  context: context,
  background: Colors.white,
  theme: ThemeData(
    primaryColor: Colors.red[400],
    accentColor: Colors.green[800],
    dialogBackgroundColor: Colors.purple[50],
    textTheme: TextTheme(
      body1: TextStyle(color: Colors.red),
      caption: TextStyle(color: Colors.blue),
    ),
    disabledColor: Colors.orange,
    accentTextTheme: TextTheme(
      body2 : TextStyle(color: Colors.green[200]),
    ),
  ),
);

Screenshot

Customize Date Picker

You can use styleDatePicker field for date picker style such as font size, weight, text color each part in the date picker.

Example custom font size and padding for displaying on a Tablet. (Pixel C, iPad 9.7")

DateTime newDateTime = await showRoundedDatePicker(
                        context: context,
                        theme: ThemeData(primarySwatch: Colors.deepPurple),
                        styleDatePicker: MaterialRoundedDatePickerStyle(
                          textStyleDayButton: TextStyle(fontSize: 36, color: Colors.white),
                          textStyleYearButton: TextStyle(
                            fontSize: 52,
                            color: Colors.white,
                          ),
                          textStyleDayHeader: TextStyle(
                            fontSize: 24,
                            color: Colors.white,
                          ),
                          textStyleCurrentDayOnCalendar:
                              TextStyle(fontSize: 32, color: Colors.white, fontWeight: FontWeight.bold),
                          textStyleDayOnCalendar: TextStyle(fontSize: 28, color: Colors.white),
                          textStyleDayOnCalendarSelected:
                              TextStyle(fontSize: 32, color: Colors.white, fontWeight: FontWeight.bold),
                          textStyleDayOnCalendarDisabled: TextStyle(fontSize: 28, color: Colors.white.withOpacity(0.1)),
                          textStyleMonthYearHeader:
                              TextStyle(fontSize: 32, color: Colors.white, fontWeight: FontWeight.bold),
                          paddingDatePicker: EdgeInsets.all(0),
                          paddingMonthHeader: EdgeInsets.all(32),
                          paddingActionBar: EdgeInsets.all(16),
                          paddingDateYearHeader: EdgeInsets.all(32),
                          sizeArrow: 50,
                          colorArrowNext: Colors.white,
                          colorArrowPrevious: Colors.white,
                          marginLeftArrowPrevious: 16,
                          marginTopArrowPrevious: 16,
                          marginTopArrowNext: 16,
                          marginRightArrowNext: 32,
                          textStyleButtonAction: TextStyle(fontSize: 28, color: Colors.white),
                          textStyleButtonPositive:
                              TextStyle(fontSize: 28, color: Colors.white, fontWeight: FontWeight.bold),
                          textStyleButtonNegative: TextStyle(fontSize: 28, color: Colors.white.withOpacity(0.5)),
                          decorationDateSelected: BoxDecoration(color: Colors.orange[600], shape: BoxShape.circle),
                          backgroundPicker: Colors.deepPurple[400],
                          backgroundActionBar: Colors.deepPurple[300],
                          backgroundHeaderMonth: Colors.deepPurple[300],
                        ),
                        styleYearPicker: MaterialRoundedYearPickerStyle(
                          textStyleYear: TextStyle(fontSize: 40, color: Colors.white),
                          textStyleYearSelected:
                              TextStyle(fontSize: 56, color: Colors.white, fontWeight: FontWeight.bold),
                          heightYearRow: 100,
                          backgroundPicker: Colors.deepPurple[400],
                        ));

Screenshot

Screenshot

Screenshot

Custom action button and text on button.

Added the action button and the button's custom text.

DateTime newDateTime = await showRoundedDatePicker(
                        ...
                        textActionButton: "ACTION",
                        onTapActionButton: (){
                           //
                        },
                        textPositiveButton: "OK",
                        textNegativeButton: "CANCEL");

Screenshot

Custom weekday header text.

Customize the header of the weekday.

DateTime newDateTime = await showRoundedDatePicker(
                        ...
                        customWeekDays: ["SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"]);

Screenshot

Custom disabled date.

Add closed date cannot be selected.

DateTime newDateTime = await showRoundedDatePicker(
                        ...
                        listDateDisabled: [
                                                  DateTime.now().subtract(Duration(days: 2)),
                                                  DateTime.now().subtract(Duration(days: 4)),
                                                  DateTime.now().subtract(Duration(days: 6)),
                                                  DateTime.now().subtract(Duration(days: 8)),
                                                  DateTime.now().subtract(Duration(days: 10)),
                                                  DateTime.now().add(Duration(days: 2)),
                                                  DateTime.now().add(Duration(days: 4)),
                                                  DateTime.now().add(Duration(days: 6)),
                                                  DateTime.now().add(Duration(days: 8)),
                                                  DateTime.now().add(Duration(days: 10)),
                                                ]);

Screenshot

Custom callback on tap day.

Add callback when tap on day.

DateTime newDateTime = await showRoundedDatePicker(
                        ...
                        onTapDay: (DateTime dateTime, bool available) {
                          if (!available) {
                            showDialog(
                                context: context,
                                builder: (c) => CupertinoAlertDialog(title: Text("This date cannot be selected."),actions: <Widget>[
                                  CupertinoDialogAction(child: Text("OK"),onPressed: (){
                                    Navigator.pop(context);
                                  },)
                                ],));
                          }
                          return available;
                        });

Screenshot

Custom builder day on date picker.

Customize the display format of the day widget.

DateTime newDateTime = await showRoundedDatePicker(
                        ...
                        builderDay:
                            (DateTime dateTime, bool isCurrentDay, bool isSelected, TextStyle defaultTextStyle) {
                          if (isSelected) {
                            return Container(
                              decoration: BoxDecoration(color: Colors.orange[600], shape: BoxShape.circle),
                              child: Center(
                                child: Text(
                                  dateTime.day.toString(),
                                  style: defaultTextStyle,
                                ),
                              ),
                            );
                          }

                          if (dateTime.day == 10) {
                            return Container(
                              decoration: BoxDecoration(
                                  border: Border.all(color: Colors.pink[300], width: 4), shape: BoxShape.circle),
                              child: Center(
                                child: Text(
                                  dateTime.day.toString(),
                                  style: defaultTextStyle,
                                ),
                              ),
                            );
                          }
                          if (dateTime.day == 12) {
                            return Container(
                              decoration: BoxDecoration(
                                  border: Border.all(color: Colors.pink[300], width: 4), shape: BoxShape.circle),
                              child: Center(
                                child: Text(
                                  dateTime.day.toString(),
                                  style: defaultTextStyle,
                                ),
                              ),
                            );
                          }

                          return Container(
                            child: Center(
                              child: Text(
                                dateTime.day.toString(),
                                style: defaultTextStyle,
                              ),
                            ),
                          );
                        });

Screenshot

Image Background Header

Use images as the header of the date picker and you can also add more details.

  • You need to specify the path of images in your asset (pubspec.yaml).
DateTime newDateTime = await showRoundedDatePicker(
  context: context,
  theme: ThemeData(primarySwatch: Colors.blue),
  imageHeader: AssetImage("assets/images/calendar_header.jpg"),
  description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
);

Screenshot

Customize Font in Date Picker

You can adjust the Font-family in the date picker.

  • You need to specify the path of font in your fonts (pubspec.yaml).
DateTime newDateTime = await showRoundedDatePicker(
  context: context,
  fontFamily: "Mali"
);

Screenshot

Date Picker Locale

You can set the date picker locale. By specifying the language code and country code. As of April 2019, this package supports about 52 languages.

DateTime newDateTime = await showRoundedDatePicker(
  context: context,
  locale: Locale("zh","CN"),
  theme: ThemeData(primarySwatch: Colors.pink),
);

Screenshot

Thai and Buddhist Year

If you are using Thai language And use the Buddhist era (543 BCE). Plugins that support these capabilities.

DateTime newDateTime = await showRoundedDatePicker(
  context: context,
  locale: Locale("th", "TH"),
  era: EraMode.BUDDHIST_YEAR,
);

Screenshot

Show Time Picker

Show time picker, all feature of date picker is available (except description)

final timePicked = await showRoundedTimePicker(
  context: context,
  initialTime: TimeOfDay.now(),
);

Screenshot

Cupertino Date Picker

Show date and duration picker iOS style.

Installing

Add Flutter Cupertino Localizations in dependencies pub.yaml.

dependencies:
  flutter:
    sdk: flutter
  flutter_localizations:
    sdk: flutter
  flutter_cupertino_localizations: 1.0.1

Initialize localizations

Add CupertinoLocalizations delegate to localizations delegate on your App. The cupertino date picker will use current app locale in picker.

MaterialApp(
  debugShowCheckedModeBanner: false,
  localizationsDelegates: [
    GlobalMaterialLocalizations.delegate,
    GlobalWidgetsLocalizations.delegate,
    DefaultCupertinoLocalizations.delegate,
    GlobalCupertinoLocalizations.delegate,  // Add global cupertino localiztions.
  ],
  locale: Locale('en', 'US'),  // Current locale
  supportedLocales: [
    const Locale('en', 'US'), // English
    const Locale('th', 'TH'), // Thai
  ],
)

Show Cupertino Date Picker

Call the method for displaying date picker. The callback date time instance will be return with onDateTimeChange.

CupertinoRoundedDatePicker.show(
  context,
  fontFamily: "Mali",
  textColor: Colors.white,
  background: Colors.red[300],
  borderRadius: 16,
  initialDatePickerMode: CupertinoDatePickerMode.date,
  onDateTimeChanged: (newDateTime) {
    //
  },
);

Screenshot

More Cupertino Date Picker Mode

CupertinoDatePickerMode.date
CupertinoDatePickerMode.dateAndTime
CupertinoDatePickerMode.time

Screenshot Screenshot

using Thai and Buddhist Year

/// Current locale is TH.
CupertinoRoundedDatePicker.show(
  context,
  fontFamily: "Mali",
  textColor: Colors.white,
  era: EraMode.BUDDHIST_YEAR,
  background: Colors.red[300],
  borderRadius: 16,
  initialDatePickerMode: CupertinoDatePickerMode.date,
  onDateTimeChanged: (newDateTime) {
    //
  },
);

Screenshot

Cupertino Duration Picker

in iOS , Flutter cupertino support duration and timer picker.

CupertinoRoundedDurationPicker.show(
  context,
  initialTimerDuration: Duration(minute:10),
  initialDurationPickerMode: CupertinoTimerPickerMode.hms,
  fontFamily: "Mali",
  onDurationChanged: (newDuration) {
    //
  },
);

Screenshot

More Cupertino Duration Picker Mode

CupertinoTimerPickerMode.hms
CupertinoTimerPickerMode.hm
CupertinoTimerPickerMode.ms

Screenshot Screenshot

Thanks

felixgabler

Comments
  • Date in listDateDisabled, still able to select

    Date in listDateDisabled, still able to select

    flutter_rounded_date_picker: 1.0.4

    25-Mar is in listDateDisabled, it should not be able to select.

    flutter_17 flutter_18

    [✓] Flutter (Channel beta, v1.15.17, on Mac OS X 10.15.1 19B88, locale en-GB) • Flutter version 1.15.17 at /Applications/flutter • Framework revision 2294d75bfa (2 weeks ago), 2020-03-07 00:28:38 +0900 • Engine revision 5aff311948 • Dart version 2.8.0 (build 2.8.0-dev.12.0 9983424a3c)

    [✗] Android toolchain - develop for Android devices ✗ Unable to locate Android SDK. Install Android Studio from: https://developer.android.com/studio/index.html On first launch it will assist you in installing the Android SDK components. (or visit https://flutter.dev/setup/#android-setup for detailed instructions). If the Android SDK has been installed to a custom location, set ANDROID_SDK_ROOT to that location. You may also want to add it to your PATH environment variable.

    [✓] Xcode - develop for iOS and macOS (Xcode 11.2) • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 11.2, Build version 11B52 • CocoaPods version 1.9.1

    [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

    [!] Android Studio (not installed) • Android Studio not found; download from https://developer.android.com/studio/index.html (or visit https://flutter.dev/setup/#android-setup for detailed instructions).

    [✓] VS Code (version 1.43.0) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.8.1

    opened by peterlau0010 3
  • New classes for v1.0 cannot be imported

    New classes for v1.0 cannot be imported

    MaterialRoundedDatePickerStyle and MaterialRoundedYearPickerStyle cannot be resolved. I have to manually add them in rounded_picker.dart generated file in order for the IDE (Android studio) to recognise them.

    opened by Dimarv135 3
  • Errors with Flutter 3.3 due to deprecations

    Errors with Flutter 3.3 due to deprecations

    A number of deprecations have been removed in Flutter 3.3 Foe example: FlatButton (in release notes: Remove deprecated FlatButton by @Piinks in https://github.com/flutter/flutter/pull/98545)

    Getting this error when trying to compile with Flutter 3.3: Error: The method 'FlatButton' isn't defined for the class 'FlutterRoundedButtonAction'.

    opened by vitalsh 2
  • Months cannot be vertically centered

    Months cannot be vertically centered

    This date selection control is great, but in my APP, the month display is not centered vertically with the arrows on both sides. Can you help me solve this problem? 688df73cff0fcbea86b988de78ef3c4

    opened by CFuLiang 1
  • Current day highlight issue

    Current day highlight issue

    in my case initial date is yesterday, but how do i highlight todays date even though it is disabled . Todays date is feb 21 i want it disabled but highlighted Screen Shot 2020-02-21 at 11 28 46 AM

    opened by praveenpke 1
  • Add onMonthChange to FlutterRoundedDatePickerDialog

    Add onMonthChange to FlutterRoundedDatePickerDialog

    Pass a function that runs on a month change. This way can load data for whatever month is currently displayed. It is only added on the dialog, but can obviously be added to the widget as well if there is an interest for it.

    opened by cruz-evan 0
  • Move sizing restrictions up to prevent exception

    Move sizing restrictions up to prevent exception

    if the height is set and overflows the screen size (minus keyboard inset etc), we get an exception otherwise

    ! the height property now includes the header and actions !

    opened by felixgabler 0
  • Move sizing restrictions up to prevent exception

    Move sizing restrictions up to prevent exception

    if the height is set and the dialog overflows the screen size (minus keyboard inset etc), we get a rendering exception otherwise. This fixes that.

    ! the height property now includes the header and actions !

    opened by felixgabler 0
  • Add time picker and some other button customizations

    Add time picker and some other button customizations

    Hi ;)

    I really like your lib, rounded picker is awesome ! But I needed to add multiple things:

    • A left button to allow user to press "Today" button for example.
    • Possibility to change "Cancel" and "Ok" button text
    • Add rounded time picker with same customization features

    In this PR you will find all of this. I also clean and format code (lib, example app and readme) and improve export methods (better for imports and avoid some duplicate code, so there is some breaking changes).

    Have a good day ;)

    opened by Pyozer 0
  • Change of Copyright notice

    Change of Copyright notice

    Hello! According to the Appendix of Apache License 2.0, if you want to license your software under this License you should "attach the boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information". This condition is not met now. Please add a copyright notice in the appropriate form, including the year of the software development and your name and surname. Thank you in advance

    Copyright [yyyy] [name of copyright owner]

    Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

    opened by julia410m 0
  • Warning: Operand of null-aware operation '!'

    Warning: Operand of null-aware operation '!'

    Below warning is displayed when I run my code on the emulator

    /C:/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_rounded_date_picker-2.0.2/lib/src/flutter_cupertino_rounded_date_picker_widget.dart:922:24: Warning: Operand of null-aware operation '!' has type 'SchedulerBinding' which excludes null.

    • 'SchedulerBinding' is from 'package:flutter/src/scheduler/binding.dart' ('/C:/flutter/packages/flutter/lib/src/scheduler/binding.dart'). package:flutter/…/scheduler/binding.dart:1 SchedulerBinding.instance!.addPostFrameCallback((Duration timestamp) {
    opened by JoniJohn 0
  • How to add hint, tooltip for tell user?

    How to add hint, tooltip for tell user?

    Most users don't know how to change the year. Can you add something looks like this?

    image

    Add some properties like

    • tooltipYearMessage: "Hi, change the year here!"
    • tooltipYearTextStyle: TextStyle()
    • tooltipBackground: Colors.transparent Or just
    • tooltipYearWidget: Widget() and this
    • tooltipAutoPlay: true
    • tooltipDuration: Duration(seconds: 3)
    opened by SittiphanSittisak 1
  • Color property of textStyleDayButton not Work.

    Color property of textStyleDayButton not Work.

    I tried to change any properties in textStyleDayButton but only the property color did not change. This color of textStyleDayButton always is white. I test it on Android and the web, and this issue is the same. How to fix this?

    opened by SittiphanSittisak 2
Owner
benznest
benznest
Text and TextField highlighted with rounded corners

rounded_background_text Highlight text with rounded corners Features ✅ Highlight

Bruno D'Luka 39 Nov 6, 2022
An easy way to add rounded corner floating app bar in Flutter project.

rounded_floating_app_bar Rounded floating app bar like new google applications has. This package provides an easy way to add rounded corner floating a

Bhavik Makwana 30 Nov 11, 2021
A modified version of the existing checkbox with the shape of a circle instead of a rounded rectangle!

A modified version of the existing checkbox with the shape of a circle instead of a rounded rectangle!

Mash Ibtesum 53 Oct 24, 2022
An app made in Flutter to help people choose the colors they will use in their projects!

Color Picker An app made in Flutter to help people choose the colors they will use in their projects! Features Pick a color from a picker wheel, palet

Bruno D'Luka 50 Nov 27, 2022
Age2 - A Flutter package to calculate someone's age in days, months, and years

age A Flutter package to calculate someone's age in days, months, and years; in

Charles Dyason 0 Feb 6, 2022
count your age by years, months,days,hours and min by flutter

countage A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if this

Hmdo 2 Sep 6, 2022
Internationalized dialog for picking a single month from an infinite list of years.

month_picker_dialog Internationalized material style dialog for picking a single month from an infinite list of years. This package makes use of the i

Dimitri Krivoj 65 Nov 30, 2022
A Flutter package for iOS and Android for picking last seven dates and time with analog view.

analog_time_picker package for Flutter A Flutter package for iOS and Android for picking last seven dates and time with analog view. Demo Installation

sk shamimul islam 12 Aug 31, 2021
A package that exports functions for converting, formatting, and nicening of dates/times in Dart.

Instant A library for manipulating and formatting DateTimes in Dart. Dates and times have never been easier. | DateTime timezone manipulation | Easy f

Aditya Kishore 10 Jan 22, 2022
A package help you to make api call and handle error faster, also you can check for internet before call api.

http_solver ##not for production use, only for learning purpose. A package help you to make api call and handle error faster, also you can check for i

Abdelrahman Saed 1 Jun 18, 2020
Album Image is based in photo_manager package and has the same concept as image_picker but with a more attractive interface to choose an image or video from the device gallery, whether it is Android or iOS

Album Image is based in photo_manager package and has the same concept as image_picker but with a more attractive interface to choose an image or vide

Phuong Vu 2 Oct 13, 2022
A smartphone application called Easy Job goal is to make easier for businesses to find people who meet their standards as well as for job seekers to search for and choose from available positions .

Easy_Jobs 19SW54(MAD-Project) A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to ge

Muskan 2 Nov 6, 2022
Destini flutter - A choose your own adventure game in flutter

destini_flutter A choose your own adventure game made with flutter. Getting Star

Joel Nickson 1 Jan 2, 2022
This is flutter package for creating a gender selection widget which allows users to choose a gender with cool animations

gender_selection A Flutter package for gender selection. It is an aweome gender selection widget with cool gradients and animation effects Demo Instal

Rohan Malik 10 Apr 8, 2022
dos downloader app is developed for downloading video. You can download video from YouTube and Facebook. You can also play video on background

dosdownloader Dos downloader app is developed for downloading video. You can download video from YouTube and Facebook. You can also play video on back

Md Abir Ahsan Tahmim 1 Dec 8, 2021
Readky is a Free Flutter News App Starter Template that can help you develop a News application much faster.

Readky. Introduction Readky is a Free Flutter News App Starter Template that can help you develop a News application much faster. You just need to add

Muhammad Rezky Sulihin 54 Nov 26, 2022
Hungry is a Free Flutter Recipe App Starter Template that can help you develop a Recipe application much faster.

Hungry is a Free Flutter Recipe App Starter Template that can help you develop a Recipe application much faster. You just need to add some adjustment to the frontend and you can create your own backend.

Muhammad Rezky Sulihin 48 Dec 20, 2022
A flutter package which will help you to create a draggable widget that can be dragged around the screen.

A flutter package which will help you to create a draggable widget that can be dragged around the screen. Demo Features ?? Manually Control the positi

Adar 31 Aug 10, 2022
A package can help you to change your flutter app's statusbar's color or navigationbar's color programmatically.

flutter_statusbarcolor A package can help you to change your flutter app's statusbar's color or navigationbar's color programmatically. Getting Starte

Zero 201 Nov 10, 2022