Skip to content

Date picker support input formatters - #184283

Closed
lrauseo wants to merge 11 commits into
flutter:masterfrom
lrauseo:date-picker-support-input-formatters
Closed

lrauseo wants to merge 11 commits into
flutter:masterfrom
lrauseo:date-picker-support-input-formatters

Conversation

@lrauseo

@lrauseo lrauseo commented Mar 28, 2026 •

Copy link
Copy Markdown

This PR includes inputFormatters in the date picker, allowing you to create textFormatters for the TextField used in InputDatePickerFormField, showDatePicker, and showDateRangePicker.

The purpose of this change is to enable input formatting within the DatePicker when it is in DatePickerEntryMode.input.

Fixes #83302
Fixes #97134
Fixes #62401
Fixes #181043
Fixes #115151

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

@github-actions github-actions Bot added framework flutter/packages/flutter repository. See also f: labels. p: material_ui material_ui package in flutter/packages d: api docs Issues with https://api.flutter.dev/ d: examples Sample code and demos labels Mar 28, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces the inputFormatters parameter to showDatePicker, showDateRangePicker, and their associated dialogs and form fields. This allows developers to provide a list of TextInputFormatter objects to control and format user input during manual date entry. The changes include updates to DatePickerDialog, DateRangePickerDialog, and InputDatePickerFormField to propagate these formatters to the underlying text fields. Additionally, a new code sample and unit tests have been added to demonstrate and verify the functionality. I have no feedback to provide.

@nate-thegrate nate-thegrate left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks so much for putting this together! I just have a few suggestions regarding documentation.

I don't really have an opinion about whether to move forward with this PR or with #181105, so I'll defer to other reviewers for an approval.

@lrauseo

lrauseo commented Mar 28, 2026 •

Copy link
Copy Markdown
Author

@nate-thegrate
Thank you for your suggestions.
In my analysis, #181105 had a very complex approach regarding providing formatting options in the date picker in input mode, creating a new delegate to format the dates. I thought about using input formatters because it's a simple and common pattern with TextFields.
But it seems that the PR #181105 has been refactored to follow the same approach.

@lrauseo

lrauseo commented Mar 30, 2026

Copy link
Copy Markdown
Author

@dkwingsmt Can this help determine which of the PRs they should follow?
this #184283 or #181105

@dkwingsmt
dkwingsmt self-requested a review April 1, 2026 18:26
@dkwingsmt

Copy link
Copy Markdown
Contributor

Let's focus our effort on #181105 , which is both opened earlier and closer to completion. However, feel free to comment on that PR as well, since I believe you have accumulated many very valuable thoughts while drafting this PR! Thank you very much for your contribution all the same. :)

@dkwingsmt dkwingsmt closed this Apr 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

d: api docs Issues with https://api.flutter.dev/ d: examples Sample code and demos framework flutter/packages/flutter repository. See also f: labels. p: material_ui material_ui package in flutter/packages

Projects

None yet

3 participants