feat: add locale prop to CupertinoDatePicker, DatePicker, DateRangePicker, TimePicker#6030
Merged
FeodorFitsner merged 16 commits intomainfrom Jan 21, 2026
Merged
feat: add locale prop to CupertinoDatePicker, DatePicker, DateRangePicker, TimePicker#6030FeodorFitsner merged 16 commits intomainfrom
locale prop to CupertinoDatePicker, DatePicker, DateRangePicker, TimePicker#6030FeodorFitsner merged 16 commits intomainfrom
Conversation
Deploying flet-examples with
|
| Latest commit: |
bad59c1
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://d6d3aabb.flet-examples.pages.dev |
| Branch Preview URL: | https://improve-locales.flet-examples.pages.dev |
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request adds a locale property to CupertinoDatePicker, DatePicker, DateRangePicker, and TimePicker controls to address issue #6009, which reported that date pickers were not respecting the page locale setting.
Changes:
- Enhanced the
LocaleandLocaleConfigurationclasses with improved validation and detailed documentation - Added a
localeproperty to all four picker controls (DatePicker, DateRangePicker, TimePicker, CupertinoDatePicker) - Implemented Dart-side locale override functionality using
Localizations.override - Added comprehensive test coverage and example files demonstrating the new feature
Reviewed changes
Copilot reviewed 21 out of 27 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
sdk/python/packages/flet/src/flet/controls/types.py |
Enhanced Locale and LocaleConfiguration dataclasses with validation, default values, and comprehensive documentation |
sdk/python/packages/flet/src/flet/controls/material/time_picker.py |
Added locale property to TimePicker |
sdk/python/packages/flet/src/flet/controls/material/date_range_picker.py |
Added locale property to DateRangePicker |
sdk/python/packages/flet/src/flet/controls/material/date_picker.py |
Added locale property to DatePicker |
sdk/python/packages/flet/src/flet/controls/cupertino/cupertino_date_picker.py |
Added locale property to CupertinoDatePicker |
packages/flet/lib/src/controls/*.dart |
Implemented locale override using Localizations.override wrapper |
packages/flet/lib/src/utils/locale.dart |
Added locale validation against Flutter's supported locales |
packages/flet/lib/src/utils/enums.dart |
Created reusable enum parsing utility |
packages/flet/lib/src/utils/misc.dart |
Refactored to use new parseEnum utility |
| Test files | Added locale-specific tests with golden image comparisons |
| Example files | Added custom_locale.py examples for each picker control |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Deploying flet-docs with
|
| Latest commit: |
bad59c1
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://9ff884ff.flet-docs.pages.dev |
| Branch Preview URL: | https://improve-locales.flet-docs.pages.dev |
Fixes this warning:
/Users/runner/work/flet/flet/sdk/python/packages/flet/src/flet/controls/control_event.py:82: DeprecationWarning: Failing to pass a value to the 'type_params' parameter of 'typing._eval_type' is deprecated, as it leads to incorrect behaviour when calling typing._eval_type on a stringified annotation that references a PEP 695 type parameter. It will be disallowed in Python 3.15.
event_type = _eval_type(event_type, globalns, localns)
# Conflicts: # sdk/python/packages/flet/src/flet/controls/control_event.py # sdk/python/packages/flet/src/flet/utils/from_dict.py
FeodorFitsner
approved these changes
Jan 21, 2026
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.
Fix #6009
Test Code
Summary by Sourcery
Add per-control locale overrides to date and time pickers and tighten locale configuration/validation across Flutter and Python layers.
New Features:
localeproperty for CupertinoDatePicker, DatePicker, DateRangePicker, and TimePicker controls to allow overriding page/system locale per picker instance.Enhancements:
LocaleandLocaleConfigurationtypes with stronger defaults, validation, and detailed documentation for language/region/script handling and resolution behaviour.Locale.isSupportedByDelegateshelper.parseEnumutility.Documentation:
Tests: