birth_date_input 1.0.2 copy "birth_date_input: ^1.0.2" to clipboard
birth_date_input: ^1.0.2 copied to clipboard

Three-field (day/month/year) date input widget for Flutter forms with built-in validation, auto-advance, paste support, and localization.

birth_date_input #

Pub Version Pub Points Pub Popularity Pub Likes

README на русском

A three-field (day / month / year) date input widget for Flutter forms — a lightweight alternative to calendar date pickers for birth date entry. Built-in validation, auto-advance, paste support, and multi-language localization. Zero external dependencies.

DD MM YYYY YYYY MM DD
[DMY] [YMD]

Features #

  • Three separate numeric fields for day, month, and year
  • Configurable field order: DMY, MDY, YMD
  • Auto-advance focus when a field is filled
  • Backspace navigates to the previous field
  • Paste support: DD.MM.YYYY, DD/MM/YYYY, DD-MM-YYYY, DDMMYYYY
  • Built-in validation: calendar correctness, year range, future date, minimum age
  • Fully customizable theme via BirthDateTheme
  • 5 built-in locales: EN, CS, RU, PL, LT — or provide your own
  • Works as a standard FormField<DateTime> — compatible with Form, FormState.validate(), onSaved

Installation #

dependencies:
  birth_date_input: ^1.0.0

Usage #

import 'package:birth_date_input/birth_date_input.dart';

BirthDateFormField(
  labelText: 'Date of birth',
  minAgeYears: 18,
  onChanged: (date) => print(date),
)

With Russian locale and YMD order #

BirthDateFormField(
  localizations: const BirthDateLocalizations.ru(),
  fieldOrder: BirthDateFieldOrder.ymd,
  labelText: 'Дата рождения',
  minAgeYears: 18,
)

Custom theme #

BirthDateFormField(
  theme: BirthDateTheme(
    borderColor: Colors.grey,
    errorColor: Colors.red,
    borderRadius: 12.0,
    inputTextStyle: TextStyle(fontSize: 16),
  ),
)

Parameters #

Parameter Type Default Description
initialValue DateTime? null Pre-filled date
labelText String? null Label above the fields
labelStyle TextStyle? null Style for the label
labelPadding EdgeInsets EdgeInsets.zero Padding around the label
minYear int 1900 Minimum allowed year
maxYear int current year Maximum allowed year
minAgeYears int? null Minimum age requirement
errorMaxLines int 2 Max lines for error text
theme BirthDateTheme defaults Visual customization
localizations BirthDateLocalizations English Localized strings
fieldOrder BirthDateFieldOrder dmy Field display order
onChanged ValueChanged<DateTime?>? null Called on every change
validator FormFieldValidator<DateTime>? built-in Custom validator
onSaved FormFieldSetter<DateTime>? null Called on form save
autovalidateMode AutovalidateMode? null When to auto-validate
enabled bool true Whether fields are enabled

Supported languages #

Code Language Constructor
EN English BirthDateLocalizations.en()
CS Czech BirthDateLocalizations.cs()
RU Russian BirthDateLocalizations.ru()
PL Polish BirthDateLocalizations.pl()
LT Lithuanian BirthDateLocalizations.lt()

To add your own language, create a BirthDateLocalizations instance with custom strings.

License #

BSD 3-Clause. See LICENSE.

1
likes
160
points
132
downloads

Publisher

unverified uploader

Weekly Downloads

Three-field (day/month/year) date input widget for Flutter forms with built-in validation, auto-advance, paste support, and localization.

Repository (GitHub)
View/report issues

Topics

#date-input #birthday #form #widget #date

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter

More

Packages that depend on birth_date_input