Skip to content

Add inputFormatters option in DatePickerDialog and InputDatePickerFormField #115151

Closed
flutter/packages
#12608

Description

@Pana-g

Use case

When using DatePickerDialog or InputDatePickerFormField in some Android devices(E.g. Samsung) slash symbol(/) is not available for TextInputType.datetime, therefore the only way to use DatePickerEntryMode.input mode is to use a different keyboardType which makes it less efficient.

Proposal

Add inputFormatters option which will allow developers to use something like mask_text_input_formatter to autocomplete slashes and improve the overall usability of the DatePickerEntryMode.input and DatePickerEntryMode.inputOnly modes.

Activity

  1. added
    in triagePresently being triaged by the triage team
    on Nov 14, 2022
  2. huycozy commented on Nov 14, 2022

    @huycozy
    Member

    Hi @Pana-g
    I still can input the slash symbol(/) when using keyboardType: TextInputType.datetime as below sample code on my Samsung device Samsung Galaxy Tab A7 Lite, Android 12 OneUI 4.1, SM-T225:

    Sample code
    import 'package:flutter/material.dart';
    
    void main() {
      runApp(const MyApp());
    }
    
    class MyApp extends StatelessWidget {
      const MyApp({Key? key}) : super(key: key);
    
      @override
      Widget build(BuildContext context) {
        return MaterialApp(
          title: 'Flutter Demo',
          theme: ThemeData(
            primarySwatch: Colors.blue,
          ),
          home: const MyHomePage(title: 'Flutter Demo Home Page'),
        );
      }
    }
    
    class MyHomePage extends StatefulWidget {
      const MyHomePage({Key? key, required this.title}) : super(key: key);
    
      final String title;
    
      @override
      State<MyHomePage> createState() => _MyHomePageState();
    }
    
    class _MyHomePageState extends State<MyHomePage> {
    
      void onPressed() {
        showDatePicker(
          keyboardType: TextInputType.datetime,
          context: context,
          initialDate: DateTime.now(),
          firstDate: DateTime(1970, 1, 1),
          lastDate: DateTime(2100, 12, 31),
        );
      }
    
      @override
      Widget build(BuildContext context) {
        return Scaffold(
          appBar: AppBar(
            title: Text(widget.title),
          ),
          body: Center(
            child: ElevatedButton(
              onPressed: onPressed,
              child: const Text('Show date picker'),
            ),
          ),
        );
      }
    }
    Demo
    XRecorder_14112022_123900.mp4

    Can you share the affected device info?

  3. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Nov 14, 2022
  4. Pana-g commented on Nov 15, 2022

    @Pana-g
    Author

    Hi @huycozy
    Thanks for your quick response! Using the sample code you provided in a Samsung Galaxy Tab A7 10.4 (2020) - SM-T500, Android Version 12 which uses Samsung Keyboard there is no slash symbol(/) option as you can see in the Demo below.

    Demo

    XRecorder_15112022_103610.mp4

  5. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Nov 15, 2022
  6. huycozy commented on Nov 16, 2022

    @huycozy
    Member

    @Pana-g It seems the issue only reproduces on specific devices as I don't see it on my other devices.
    I also see you filed a PR for this. Labeling this issue for further tracking/investigation. Thank you!

    flutter doctor -v (stable and master)
    [✓] Flutter (Channel stable, 3.3.8, on macOS 13.0 22A380 darwin-x64, locale en-VN)
        • Flutter version 3.3.8 on channel stable at /Users/huynq/Documents/GitHub/flutter
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision 52b3dc25f6 (23 hours ago), 2022-11-09 12:09:26 +0800
        • Engine revision 857bd6b74c
        • Dart version 2.18.4
        • DevTools version 2.15.0
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
        • Android SDK at /Users/huynq/Library/Android/sdk
        • Platform android-33, build-tools 31.0.0
        • ANDROID_HOME = /Users/huynq/Library/Android/sdk
        • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
        • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 14.0.1)
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Build 14A400
        • CocoaPods version 1.11.3
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] Android Studio (version 2021.3)
        • Android Studio at /Applications/Android Studio.app/Contents
        • Flutter plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/9212-flutter
        • Dart plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/6351-dart
        • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
    
    [✓] IntelliJ IDEA Community Edition (version 2022.2.2)
        • IntelliJ at /Applications/IntelliJ IDEA CE.app
        • Flutter plugin version 70.0.5
        • Dart plugin version 222.4167.21
    
    [✓] IntelliJ IDEA Community Edition (version 2022.1.1)
        • IntelliJ at /Users/huynq/Library/Application Support/JetBrains/Toolbox/apps/IDEA-C/ch-0/221.5591.52/IntelliJ IDEA CE.app
        • Flutter plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/9212-flutter
        • Dart plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/6351-dart
    
    [✓] VS Code (version 1.73.0)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.52.0
    
    [✓] Connected device (3 available)
        • iPhone 14 Pro Max (mobile) • 332079AF-E895-4685-910E-7B1E18B0C6B8 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-16-0 (simulator)
        • macOS (desktop)            • macos                                • darwin-x64     • macOS 13.0 22A380 darwin-x64
        • Chrome (web)               • chrome                               • web-javascript • Google Chrome 107.0.5304.110
    
    [✓] HTTP Host Availability
        • All required HTTP hosts are available
    
    • No issues found!
    
    [!] Flutter (Channel master, 3.6.0-3.0.pre.48, on macOS 13.0 22A380 darwin-x64, locale en-VN)
        • Flutter version 3.6.0-3.0.pre.48 on channel master at /Users/huynq/Documents/GitHub/flutter_master
        ! Warning: `flutter` on your path resolves to /Users/huynq/Documents/GitHub/flutter/bin/flutter, which is not inside your current Flutter SDK checkout at /Users/huynq/Documents/GitHub/flutter_master. Consider adding /Users/huynq/Documents/GitHub/flutter_master/bin to the front of your path.
        ! Warning: `dart` on your path resolves to /Users/huynq/Documents/GitHub/flutter/bin/dart, which is not inside your current Flutter SDK checkout at /Users/huynq/Documents/GitHub/flutter_master. Consider adding /Users/huynq/Documents/GitHub/flutter_master/bin to the front of your path.
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision 93c4b09e62 (15 minutes ago), 2022-11-15 18:07:50 -0800
        • Engine revision baad8f2c55
        • Dart version 2.19.0 (build 2.19.0-403.0.dev)
        • DevTools version 2.19.0
        • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
        • Android SDK at /Users/huynq/Library/Android/sdk
        • Platform android-33, build-tools 31.0.0
        • ANDROID_HOME = /Users/huynq/Library/Android/sdk
        • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
        • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 14.0.1)
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Build 14A400
        • CocoaPods version 1.11.3
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] Android Studio (version 2021.3)
        • Android Studio at /Applications/Android Studio.app/Contents
        • Flutter plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/9212-flutter
        • Dart plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/6351-dart
        • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
    
    [✓] IntelliJ IDEA Community Edition (version 2022.2.2)
        • IntelliJ at /Applications/IntelliJ IDEA CE.app
        • Flutter plugin version 70.0.5
        • Dart plugin version 222.4167.21
    
    [✓] IntelliJ IDEA Community Edition (version 2022.1.1)
        • IntelliJ at /Users/huynq/Library/Application Support/JetBrains/Toolbox/apps/IDEA-C/ch-0/221.5591.52/IntelliJ IDEA CE.app
        • Flutter plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/9212-flutter
        • Dart plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/6351-dart
    
    [✓] VS Code (version 1.73.1)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.52.0
    
    [✓] Connected device (3 available)
        • RMX2001 (mobile) • EUYTFEUSQSRGDA6D • android-arm64  • Android 11 (API 30)
        • macOS (desktop)  • macos            • darwin-x64     • macOS 13.0 22A380 darwin-x64
        • Chrome (web)     • chrome           • web-javascript • Google Chrome 107.0.5304.110
    
    [✓] HTTP Host Availability
        • All required HTTP hosts are available
    
    ! Doctor found issues in 1 category.
    
  7. added
    frameworkflutter/packages/flutter repository. See also f: labels.
    p: material_uimaterial_ui package in flutter/packages
    c: proposalA detailed proposal for a change to Flutter
    and removed
    in triagePresently being triaged by the triage team
    on Nov 16, 2022
  8. rubensdemelo commented on Feb 19, 2023

    @rubensdemelo
    Contributor

    same issue: no /

    return InputDatePickerFormField(
      keyboardType: TextInputType.datetime,
      initialDate: DateTime.now(),
      firstDate: DateTime.now(),
      lastDate: DateTime.now().add(Duration(days: 7)),
    );

    Screenshot_20230218_233731

    flutter doctor -v:

    ➜  ~ flutter doctor -v
    [✓] Flutter (Channel stable, 3.7.3, on macOS 12.6 21G115 darwin-x64, locale
        en-BR)
        • Flutter version 3.7.3 on channel stable at /Users/rubensmelo/flutter
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision 9944297138 (10 days ago), 2023-02-08 15:46:04 -0800
        • Engine revision 248290d6d5
        • Dart version 2.19.2
        • DevTools version 2.20.1
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
        • Android SDK at /Users/rubensmelo/Library/Android/sdk
        • Platform android-33, build-tools 33.0.0
        • Java binary at: /Applications/Android
          Studio.app/Contents/jre/Contents/Home/bin/java
        • Java version OpenJDK Runtime Environment (build
          11.0.13+0-b1751.21-8125866)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 14.2)
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Build 14C18
        • CocoaPods version 1.11.3
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] Android Studio (version 2021.3)
        • Android Studio at /Applications/Android Studio.app/Contents
        • Flutter plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/9212-flutter
        • Dart plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/6351-dart
        • Java version OpenJDK Runtime Environment (build
          11.0.13+0-b1751.21-8125866)
    
    [✓] VS Code (version 1.75.1)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.58.0
    
    [✓] Connected device (3 available)
        • SM A325M (mobile) • RX8RA0HZNXD • android-arm64  • Android 13 (API 33)
        • macOS (desktop)   • macos       • darwin-x64     • macOS 12.6 21G115
          darwin-x64
        • Chrome (web)      • chrome      • web-javascript • Google Chrome
          109.0.5414.87
    
    [✓] HTTP Host Availability
        • All required HTTP hosts are available
    
    • No issues found!
    
  9. Hixie commented on Oct 31, 2023

    @Hixie
    Contributor

    @Pana-g made some progress on this in #115144, if anyone would like to pick it up and land it that would be a good place to start! See the comments in that PR for next steps.

  10. added
    has partial patchThere is a PR awaiting someone to take it across the finish line
    on Oct 31, 2023
  11. Muzammil-Bit commented on Mar 21, 2024

    @Muzammil-Bit
  12. added
    P3Issues that are less important to the Flutter project
    on Jul 22, 2025
  13. added
    packageflutter/packages repository. See also p: labels.
    and removed
    frameworkflutter/packages/flutter repository. See also f: labels.
    on Aug 17, 2026
  14. added a commit that references this issue on Sep 10, 2026
    c437326
  15. github-actions commented on Sep 24, 2026

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  16. locked as resolved and limited conversation to collaborators on Sep 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projectc: proposalA detailed proposal for a change to Flutterf: date/time pickerDate or time picker widgetshas partial patchThere is a PR awaiting someone to take it across the finish linep: material_uimaterial_ui package in flutter/packagespackageflutter/packages repository. See also p: labels.team-designOwned by Design Languages teamtriaged-designTriaged by Design Languages team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions