All Projects → highpeaksw → flutter_date_picker

highpeaksw / flutter_date_picker

Licence: Apache-2.0 license
A Cupertino style date picker for Android and IOS

Programming Languages

dart
5743 projects
objective c
16641 projects - #2 most used programming language
java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to flutter date picker

Blazor.PersianDatePicker
A free JavaScript Jalali (Persian) and Gregorian (Miladi) dual datepicker library for Blazor applications
Stars: ✭ 40 (-48.72%)
Mutual labels:  datepicker
datepicker
A simple datepicker with Chakra-UI and date-fns
Stars: ✭ 140 (+79.49%)
Mutual labels:  datepicker
datePicker
时间选择器,包含年月、年月日、年月日时分秒、
Stars: ✭ 14 (-82.05%)
Mutual labels:  datepicker
NodaTimePicker
A Date/Time picker component library for Blazor using NodaTime
Stars: ✭ 49 (-37.18%)
Mutual labels:  datepicker
vue3-date-time-picker
Datepicker component for Vue 3
Stars: ✭ 157 (+101.28%)
Mutual labels:  datepicker
rn-date-range
date picker component for react native
Stars: ✭ 16 (-79.49%)
Mutual labels:  datepicker
tailwind-datepicker
A Tailwind CSS datepicker built with vanilla JavaScript
Stars: ✭ 105 (+34.62%)
Mutual labels:  datepicker
TypePicker
A date picker use in web and react-native
Stars: ✭ 14 (-82.05%)
Mutual labels:  datepicker
jquery-datepicker
A full-featured datepicker jquery plugin
Stars: ✭ 35 (-55.13%)
Mutual labels:  datepicker
FlutterLoadingGIFs
Loading indicator GIFs. Material and Cupertino (Android and iOS) loading indicators in assorted sizes. Use as placeholders for loading remote image assets. Demo: https://gallery.codelessly.com/flutterwebsites/loadinggifs/
Stars: ✭ 28 (-64.1%)
Mutual labels:  cupertino
react-dates
An easily internationalizable, mobile-friendly datepicker library for the web
Stars: ✭ 12,032 (+15325.64%)
Mutual labels:  datepicker
persian-mobile-datepicker
Modern React Persian Mobile Date and Time picker
Stars: ✭ 93 (+19.23%)
Mutual labels:  datepicker
flatpickr-rails
This gem packages flatpickr's assets for drop-in use in Rails applications.
Stars: ✭ 29 (-62.82%)
Mutual labels:  datepicker
ng-persian-datepicker
Persian datepicker for angular 12+
Stars: ✭ 62 (-20.51%)
Mutual labels:  datepicker
vue-date-range-picker
A vue component using Bootstrap 4 styles for date range selection
Stars: ✭ 30 (-61.54%)
Mutual labels:  datepicker
iOSProjects
It's project that contains different applications developed with Swift 5.7 👨‍💻👩🏼‍💻🧑🏿‍💻
Stars: ✭ 122 (+56.41%)
Mutual labels:  datepicker
yii2-datetime-widgets
Datetime widgets for Yii2
Stars: ✭ 22 (-71.79%)
Mutual labels:  datepicker
jquery-date-dropdowns
A simple, customisable jQuery datepicker plugin to dynamically generate separate "day", "month" and "year" dropdowns, and provide a formatted date string for form submission
Stars: ✭ 42 (-46.15%)
Mutual labels:  datepicker
s-date-range-picker
📅 A date range picker built with Svelte
Stars: ✭ 13 (-83.33%)
Mutual labels:  datepicker
silverware-calendar
SilverWare Calendar Module
Stars: ✭ 15 (-80.77%)
Mutual labels:  datepicker

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.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].