-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Description
Use case
Allow customization of the manual input field in showDatePicker
Problem
When using showDatePicker with DatePickerEntryMode.input or inputOnly, the manual date entry field does not expose any way to customize text input behavior.
Specifically, it is not possible to provide:
TextInputFormatter(e.g. input masks likedd/MM/yyyy)- A custom
TextEditingController - Any hook or builder to customize the internal
TextField
This makes it impossible to enforce locale-specific date formats or guide users while typing.
Why this is an issue
- Many locales rely on strict date formats (e.g.
dd/MM/yyyyin most of the world) - Free text input easily leads to invalid or ambiguous dates
- Developers are forced to disable manual input entirely (
calendarOnly) or reimplement a custom date picker - This breaks consistency with
TextField, which already supports formatters and controllers
This is not a bug, but a limitation in the current API that affects extensibility and usability.
Current workaround
- Disable manual input using
DatePickerEntryMode.calendarOnly, or - Build a fully custom date picker, losing native Material UX and accessibility benefits
Flutter version
Flutter 3.38.7 • channel stable
Tools • Dart 3.10.7 • DevTools 2.51.1
Image of the Issue
The screenshot below shows the manual date input mode in showDatePicker, where the text field does not apply any input mask or formatting, allowing free-form input that can lead to invalid or ambiguous dates.
Proposal
Provide a way to add/customize the manual input field used by showDatePicker, for example:
- Allow passing custom
TextInputFormatterinstances. - Allow providing a
TextEditingController. - Or expose a builder or callback to customize the internal input field.
Optionally, the framework could offer a locale-aware date input formatter that developers may choose to use.
This would allow developers to keep the native Material date picker while enforcing proper input formats.