Flutter_date_picker

A Cupertino style date picker for Android and IOS
Alternatives To Flutter_date_picker
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Pickadate.js7,707
3 years ago285mitJavaScript
The mobile-friendly, responsive, and lightweight jQuery date & time input picker.
React Datepicker7,2143,3971,502a day ago150May 17, 2022246mitJavaScript
A simple and reusable datepicker component for React
Tempus Dominus7,0701,3871329 days ago11December 17, 202023mitHTML
A powerful Date/time picker widget.
Materialdatetimepicker4,6041,08432 years ago54August 30, 2019102apache-2.0Java
Pick a date or time on Android in style
Datetimepicker3,47618338a month ago25February 23, 2019427mitJavaScript
jQuery Plugin Date and Time Picker
Tcomb Form Native3,162499187 months ago53October 11, 2018128mitJavaScript
Forms library for react-native
React Native Modal Datetime Picker2,689488942 months ago90September 06, 202213mitJavaScript
A React-Native datetime-picker for Android and iOS
Brpickerview2,324
143 months ago49July 08, 2022122mitObjective-C
BRPickerView 封装的是iOS中常用的选择器组件,主要包括:日期选择器(支持年月日、年月等15种日期样式选择,支持设置星期、至今等)、地址选择器(支持省市区、省市、省三种地区选择)、自定义字符串选择器(支持单列、多列、二级联动、三级联动选择)。支持自定义主题样式,适配深色模式,支持将选择器组件添加到指定容器视图。
Sublimepicker2,286
3 years ago64apache-2.0Java
A material-styled android view that provisions picking of a date, time & recurrence option, all from a single user-interface.
Pdtsimplecalendar1,954
315 years ago8August 27, 201537apache-2.0Objective-C
A simple Calendar / Date Picker for iOS using UICollectionView
Alternatives To Flutter_date_picker
Select To Compare


Alternative Project Comparisons
Readme

flutter_date_picker

Cupertino styled date and time picker component which works on both ios and android.

Pub

Example

For example on how to use the component repo.

Features

  • Seperate Date picker Component.
  • Seperate Time picker Component.
  • CustomShape for Selected Item.
  • CustomGradient for Submit Button.
  • CustomItemColor for Selected Item.

Getting started

In the pubspec.yaml of your flutter project, add the following dependency:

dependencies:
  ...
  flutter_date_picker: "^0.1.8"

In your library add the following import:

import 'package:flutter_date_picker/flutter_date_picker.dart';
import 'package:flutter_date_picker/flutter_time_picker.dart';

For help getting started with Flutter, view the online documentation.

Usage

Let's demo the basic usage with CustomItemColor, CustomShape and CustomGradient

import 'package:flutter/material.dart';
import 'package:flutter_date_picker/flutter_date_picker.dart';
import 'package:flutter_date_picker/flutter_time_picker.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 {
  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();

  VoidCallback _showBottomSheetCallback;
  bool showDatePicker = false;

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

    _showBottomSheetCallback = _showBottomSheet;
  }

  void _snackBar(String text) {
    _scaffoldKey.currentState.showSnackBar(SnackBar(content: Text(text)));
  }

   _showBottomSheet(String picker) {
    setState(() {
      // disable the button
      _showBottomSheetCallback = null;
    });
    _scaffoldKey.currentState
        .showBottomSheet<Null>(
          (BuildContext context) {
            switch (picker) {
              case 'DatePicker':
                return DatePicker(
                  key: dobKey,
                  setDate: _setDate,
                  customShape: StadiumBorder(
                      side: BorderSide(
                    color: Color(0xFFF991A0),
                  )),
                );
              case 'TimePicker':
                return TimePicker(
                  key: tobKey,
                  setTime: _setTime,
                  customShape: BeveledRectangleBorder(
                    borderRadius: BorderRadius.only(
                      topLeft: Radius.circular(15.0),
                      topRight: Radius.circular(15.0),
                      bottomLeft: Radius.circular(15.0),
                      bottomRight: Radius.circular(15.0),
                    ),
                  ),
                );
            }
          },
        )
        .closed
        .whenComplete(() {
          if (mounted) {
            setState(() {
              // re-enable the button
              _showBottomSheetCallback = _showBottomSheet;
            });
          }
        });
  }

  void _setDate() {
    Navigator.of(context).pop();

    _snackBar(dobKey.currentState.dobStrMonth +
        ' ${dobKey.currentState.dobDate}' +
        ' ${dobKey.currentState.dobYear}');
  }

  void _setTime() {
    Navigator.of(context).pop();
    var hour = tobKey.currentState.hour;

    var min = tobKey.currentState.minute;

    var sec = tobKey.currentState.seconds;

    _snackBar("$hour:$min:$sec ${tobKey.currentState.sunOrMoon}");
  }

  @override
  Widget build(BuildContext context) {
    return SafeArea(
      bottom: false,
      child: Scaffold(
        key: _scaffoldKey,
        appBar: AppBar(
          backgroundColor: Color(0xFFF98495),
          title: Text('Date Picker'),
        ),
        body: Row(
          mainAxisAlignment: MainAxisAlignment.spaceEvenly,
          children: <Widget>[
            Container(
              padding: EdgeInsets.all(10.0),
              alignment: Alignment.topCenter,
              child: RaisedButton(
                color: Color(0xFFF98495),
                child: Text('Date Picker'),
                onPressed: () {
                  _showBottomSheet('DatePicker');
                },
              ),
            ),
            Container(
              padding: EdgeInsets.all(10.0),
              alignment: Alignment.topCenter,
              child: RaisedButton(
                color: Color(0xFFF98495),
                child: Text('Time Picker'),
                onPressed: () {
                  _showBottomSheet('TimePicker');
                },
              ),
            ),
          ],
        ),
      ),
    );
  }
}

Changelog

Please see the Changelog page to know what's recently changed.

License

Copyright 2018 Rajesh Kumar

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.
Popular Picker Projects
Popular Date Projects
Popular User Interface Components Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Dart
Flutter
Date
Picker
Changelog
Datepicker