Giter VIP home page Giter VIP logo

date_field's Introduction

Welcome to the Date Field package! ๐Ÿ“…

pub package

This package provides two widgets, DateTimeField and DateTimeFormField, which allow users to pick a date and/or time from an input field. You can customize the appearance of the widgets using the decoration argument, and specify whether to ask for a date, a time, or both using the mode parameter.

Here's how to get started ๐Ÿš€

Add the date_field package to your project's dependencies in pubspec.yaml.

dependencies:
  ...
  date_field: ^3.0.5

Import the package in your Dart code.

import 'package:date_field/date_field.dart';

Use the DateTimeField or DateTimeFormField widget in your code, and customize it using the available parameters.

Available Parameters ๐Ÿ“

  • onSaved: a callback that is called when the form is saved.
  • validator: a callback that is called to validate the value.
  • initialValue: the initial value of the field.
  • autovalidateMode: when to validate the field.
  • enabled: whether the field is enabled or disabled.
  • use24hFormat: whether to use a 24-hour format for the time picker.
  • dateTextStyle: the text style for the date.
  • dateFormat: the format of the date.
  • firstDate: the earliest date that can be selected.
  • lastDate: the latest date that can be selected.
  • initialDate: the initial date that is selected.
  • onDateSelected: a callback that is called when a date is selected.
  • decoration: the decoration for the field.
  • initialEntryMode: the initial entry mode of the date picker.
  • initialDatePickerMode: the initial date picker mode.
  • mode: the mode of the date and time picker.
  • initialTimePickerEntryMode: the initial entry mode of the time picker.
  • fieldCreator: the creator of the DateTimeField.

Example Usage ๐Ÿ“–

Here's an example usage of DateTimeFormField:

DateTimeFormField(
  decoration: const InputDecoration(
    hintStyle: TextStyle(color: Colors.black45),
    errorStyle: TextStyle(color: Colors.redAccent),
    border: OutlineInputBorder(),
    suffixIcon: Icon(Icons.event_note),
    labelText: 'Only time',
  ),
  mode: DateTimeFieldPickerMode.time,
  autovalidateMode: AutovalidateMode.always,
  validator: (e) => (e?.day ?? 0) == 1 ? 'Please not the first day' : null,
  onDateSelected: (DateTime value) {
    print(value);
  },
)

You can find more examples and a complete example on the GitHub repository. We hope this package is helpful to you!

License ๐Ÿ“œ

This package is released under the MIT license.

Contributing ๐Ÿค

Contributions to this package are welcome! If you find a bug or have a feature request, please create an issue on the GitHub repository. If you'd like to contribute code, please create a pull request with your changes.

Before submitting a pull request, please make sure to run the tests and ensure they all pass. Additionally, please follow the existing coding style and make sure your code is well-documented.

Thank you for your contributions!

date_field's People

Contributors

gaspardmerten avatar axrs avatar theglorysaint avatar schalky avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.