flutter_rounded_date_picker 0.2.3

  • Readme
  • Changelog
  • Example
  • Installing
  • 91

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: 0.2.0

Importing #

import packages into your dart.

import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:flutter_rounded_date_picker/rounded_date_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 RoundedDatePicker.show(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 RoundedDatePicker.show(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 RoundedDatePicker.show(context, theme: ThemeData(primarySwatch: Colors.pink));

Screenshot

Dark theme

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

Screenshot

Custom Theme with ThemeData

DateTime newDateTime = await RoundedDatePicker.show(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

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 RoundedDatePicker.show(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 RoundedDatePicker.show(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 RoundedDatePicker.show(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 RoundedDatePicker.show(context, 
                                    locale: Locale("th", "TH"), 
                                    era: EraMode.BUDDHIST_YEAR);

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

0.2.3 #

0.2.2 #

0.2.1 #

0.2.0 #

  • support cupertino date time picker.
  • support cupertino duration picker.

0.1.0 #

  • support border radius date picker.
  • support thai buddhist year.

example/README.md

flutter_rounded_date_picker_example #

Demonstrates how to use the flutter_rounded_date_picker plugin.

Getting Started #

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

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

Use this package as a library

1. Depend on it

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


dependencies:
  flutter_rounded_date_picker: ^0.2.3

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_rounded_date_picker/cupertino_rounded_date_picker.dart';
import 'package:flutter_rounded_date_picker/cupertino_rounded_duration_picker.dart';
import 'package:flutter_rounded_date_picker/era_mode.dart';
import 'package:flutter_rounded_date_picker/flutter_cupertino_rounded_date_picker_widget.dart';
import 'package:flutter_rounded_date_picker/flutter_rounded_date_picker_widget.dart';
import 'package:flutter_rounded_date_picker/rounded_date_picker.dart';
import 'package:flutter_rounded_date_picker/thai_date_utils.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
81
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]
91
Learn more about scoring.

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

  • Dart: 2.5.1
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.4

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

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

Analysis of lib/cupertino_rounded_date_picker.dart reported 1 hint:

line 6 col 8: Unused import: 'package:flutter_rounded_date_picker/flutter_rounded_date_picker_widget.dart'.

Format lib/flutter_cupertino_rounded_date_picker_widget.dart.

Run flutter format to format lib/flutter_cupertino_rounded_date_picker_widget.dart.

Format lib/flutter_rounded_date_picker_widget.dart.

Run flutter format to format lib/flutter_rounded_date_picker_widget.dart.

Format lib/rounded_date_picker.dart.

Run flutter format to format lib/rounded_date_picker.dart.

Dependencies

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