Replace FTimeField/FDateField format DateFormat with callback#966
Merged
Conversation
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates FTimeField.picker(format: ...) and FDateField.calendar(format: ...) to accept a formatting callback instead of a DateFormat?, enabling callers to compose/customize output while receiving the locale-aware default DateFormat.
Changes:
- Introduce
FTimeField.defaultFormat/FDateField.defaultFormatas new defaults for the formatter callback. - Update picker/calendar implementations to call the formatter callback with the computed locale-aware
DateFormat. - Update tests, docs snippets, and CHANGELOG for the breaking API change.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| forui/lib/src/widgets/time_field/time_field.dart | Adds defaultFormat and changes picker factory format parameter type to a callback. |
| forui/lib/src/widgets/time_field/picker/picker_time_field.dart | Switches internal formatting logic to call the callback (defaulting to FTimeField.defaultFormat). |
| forui/lib/src/widgets/date_field/date_field.dart | Adds defaultFormat and changes calendar factory format parameter type to a callback. |
| forui/lib/src/widgets/date_field/calendar/calendar_date_field.dart | Switches internal formatting logic to call the callback (defaulting to FDateField.defaultFormat). |
| forui/test/src/widgets/time_field/picker/picker_time_field_test.dart | Updates the “custom format” test to the new callback API. |
| forui/test/src/widgets/date_field/calendar/calendar_date_field_test.dart | Updates the “custom format” test to the new callback API. |
| docs_snippets/lib/usages/widgets/time_field.dart | Updates snippet to use FTimeField.defaultFormat and removes intl import. |
| docs_snippets/lib/usages/widgets/date_field.dart | Updates snippet to use FDateField.defaultFormat. |
| forui/CHANGELOG.md | Documents the breaking change and the new default formatter helpers. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
Documentation Preview
You're seeing this because the docs/samples were updated. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe the changes
FTimeField.picker(format: ...)andFDateField.calendar(format: ...)fromDateFormat?toString Function(BuildContext, FTime/DateTime, DateFormat)— the callback receives the locale-aware defaultDateFormatso callers can compose or fall back to it.FTimeField.defaultFormatandFDateField.defaultFormatstatic functions used as the new non-nullable defaults (mirrorsFDateTimePicker.defaultDateBuilder/FDateField.defaultIconBuilder).custom formattests, docs_snippets usages, and CHANGELOG.Checklist