date_field 0.1.2

  • Readme
  • Changelog
  • Example
  • Installing
  • 90

date_field #

Contains DateField and DateFormField which allows the user to pick a DateTime from an input field!

Getting Started #

Just to let you know, this is how it looks like without any customization:

The best way to discover this package is simply to check the example page!

There are two widgets in this package:

  • DateField
  • DateFormField

The second one is wrapping the first one with a FormField widget! This way you can integrate it in your form structure flawlessly.

The DateField widget returns an InputDecorator with an Inkwell which will display a date picker (platform responsive) which allows the user to select the date he wants!

You can customize the widget a lot thanks to these parameters:

onSaved, validator, initialValue, autovalidate, enabled, firstDate, lastDate, label, dateFormat, decoration, initialDatePickerMode

0.0.1 #

  • Initial version

0.0.2 #

  • Fixing README.md
  • Updating package description
  • Formatting with DartFM

0.1.0 #

  • Updating documentation!

0.1.1 #

  • Formatting with DartFM!

0.1.2 #

  • Fixing an incorrect boolean (iOS picker was inverted with the Android one)

example/main.dart

import 'package:date_field/date_field.dart';
import 'package:flutter/material.dart';

void main() {
  WidgetsFlutterBinding.ensureInitialized();

  runApp(ExampleApp());
}

class ExampleApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(title: 'Example app', home: HomeWidget());
  }
}

class HomeWidget extends StatefulWidget {
  @override
  _HomeWidgetState createState() => _HomeWidgetState();
}

class _HomeWidgetState extends State<HomeWidget> {
  DateTime selectedDate;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Column(
        children: <Widget>[
          Column(
            children: <Widget>[
              DateField(
                selectedDate: selectedDate,
                onDateSelected: (DateTime date) {
                  setState(() {
                    selectedDate = date;
                  });
                },
                lastDate: DateTime(2020),
              ),
            ],
          ),
        ],
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  date_field: ^0.1.2

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:date_field/date_field.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
79
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]
90
Learn more about scoring.

We analyzed this package on May 30, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.2
  • pana: 0.13.8-dev
  • Flutter: 1.17.1

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
intl ^0.16.1 0.16.1
Transitive dependencies
collection 1.14.12
meta 1.1.8
path 1.7.0
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8