Date picker support input formatters#184283
Conversation
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
I love the interactive code sample! But it doesn't look like it's being used anywhere. Consider adding it to our documentation somewhere; here's an example:
flutter/packages/flutter/lib/src/material/date_picker.dart
Lines 160 to 165 in 47018b1
Co-authored-by: Nate Wilson <nathan.wilson1232@gmail.com>
Co-authored-by: Nate Wilson <nathan.wilson1232@gmail.com>
|
@nate-thegrate |
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-assistbot 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.