Search packages, repositories and app categories

Package detailsv2.1.0

datetime_picker_formfield_new

A TextFormField that emits DateTimes and helps show Material, Cupertino, and other style picker dialogs.

AndroidiOSWebmacOSWindowsLinux
30-day downloads
8.4K
Likes
34
Pub points
140

Install package

flutter pub add datetime_picker_formfield_new

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

A Flutter package that provides a TextFormField capable of emitting DateTime values and integrating with Material, Cupertino, and other styled date/time picker dialogs. It simplifies form handling by combining input fields with intuitive picker interfaces across platforms. Designed for seamless use in forms requiring date or time selection, it supports multiple platforms including Android, iOS, Web, macOS, Windows, and Linux. The package enhances user experience by offering consistent, platform-adaptive pickers with minimal setup.

Use cases

  • Form inputs requiring date/time selection
  • Cross-platform date/time entry
  • Integration with form validation
  • Customizable picker styling
  • Dynamic form field updates
  • User-friendly time input in mobile and web apps

Key features

  • Supports Material and Cupertino pickers
  • Emits DateTime objects
  • Cross-platform compatibility
  • Easy integration with Form widgets
  • Customizable dialog appearance
  • Built-in validation support

Suitable for

  • Developers building cross-platform forms
  • Apps needing date/time input with native look
  • Teams prioritizing consistent UX across devices
  • Projects using Flutter's form architecture
  • Users wanting minimal boilerplate for date pickers

Considerations

  • Requires Flutter 2.0+
  • May need additional styling for complex themes
  • Limited to basic date/time formats
  • No built-in localization support
  • Depends on underlying platform picker behavior
  • Not suitable for highly customized picker UIs

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

DateTimeField

A TextFormField that emits DateTimes and helps show Material, Cupertino, and other style picker dialogs.

Fork with support for flutter >3.0.0

Example

See the example tab (example/lib/main.dart) for more.

screenshot.gif

import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:datetime_picker_formfield/datetime_picker_formfield.dart';

// ...

class BasicDateField extends StatelessWidget {
  final format = DateFormat("yyyy-MM-dd");
  @override
  Widget build(BuildContext context) {
    return Column(children: <Widget>[
      Text('Basic date field (${format.pattern})'),
      DateTimeField(
        format: format,
        onShowPicker: (context, currentValue) {
          return showDatePicker(
            context: context,
            firstDate: DateTime(1900),
            initialDate: currentValue ?? DateTime.now(),
            lastDate: DateTime(2100),
          );
        },
      ),
    ]);
  }
}

class BasicTimeField extends StatelessWidget {
  final format = DateFormat("HH:mm");
  @override
  Widget build(BuildContext context) {
    return Column(children: <Widget>[
      Text('Basic time field (${format.pattern})'),
      DateTimeField(
        format: format,
        onShowPicker: (context, currentValue) async {
          final time = await showTimePicker(
            context: context,
            initialTime: TimeOfDay.fromDateTime(currentValue ?? DateTime.now()),
          );
          return DateTimeField.convert(time);
        },
      ),
    ]);
  }
}

class BasicDateTimeField extends StatelessWidget {
  final format = DateFormat("yyyy-MM-dd HH:mm");
  @override
  Widget build(BuildContext context) {
    return Column(children: <Widget>[
      Text('Basic date & time field (${format.pattern})'),
      DateTimeField(
        format: format,
        onShowPicker: (context, currentValue) async {
          return await showDatePicker(
            context: context,
            firstDate: DateTime(1900),
            initialDate: currentValue ?? DateTime.now(),
            lastDate: DateTime(2100),
          ).then((DateTime? date) async {
            if (date != null) {
              final time = await showTimePicker(
                context: context,
                initialTime:
                    TimeOfDay.fromDateTime(currentValue ?? DateTime.now()),
              );
              return DateTimeField.combine(date, time);
            } else {
              return currentValue;
            }
          });
        },
      ),
    ]);
  }
}

Categories

Dependencies

Dependency list 1 items

Source repository

Projects using this package