Repository navigation
Time picker error in locales that do not use Latin digits - #186311
lamnhan066 wants to merge 11 commits into
Conversation
9791330 to
742608f
Compare
There was a problem hiding this comment.
Code Review
This pull request introduces localized number parsing for the time picker's text input fields. It adds logic to cache localized digit mappings, clear them on locale changes, and strip localized leading zeros. A new test suite verifies these changes across multiple locales. Feedback was provided to ensure the leading zero removal logic correctly handles multi-unit characters.
e9ee0f9 to
4e88fb9
Compare
4e88fb9 to
717b2aa
Compare
717b2aa to
47c8ad3
Compare
|
Hi @QuncCccccc I understand that the Material and Cupertino libraries are currently code-frozen, but I would like to know what steps I should take next for this PR. Thank you. |
|
Thanks a lot for the contribution! I'll take a look soon and once we get enough approvals for this PR, we'll mark this PR draft. When |
QuncCccccc
left a comment
There was a problem hiding this comment.
Overall looks good to me! Just left a few comments. Thanks for the fix!
| @override | ||
| void didChangeDependencies() { | ||
| super.didChangeDependencies(); | ||
| final Locale locale = Localizations.localeOf(context); |
There was a problem hiding this comment.
The cache is built by MaterialLocalizations. Should we check MaterialLocalizations instead?
There was a problem hiding this comment.
I prefer keeping Localizations.localeOf since MaterialLocalizations lacks an equivalent method. We should also avoid using MaterialLocalizations type for caching comparisons because its equality isn't as reliable as Locale's (which can handles deprecated locales).
There was a problem hiding this comment.
I see! Thanks for the explanation! Overall it looks good! I'll take another look tomorrow!
47c8ad3 to
f716746
Compare
QuncCccccc
left a comment
There was a problem hiding this comment.
LGTM! Thanks a lot for the fix and the test coverage. There seems some more discussion in the original issue about 24-hour input case. But I think that's a separate issue and the latin digits parsing issue described in the description has been fixed.
|
I see that the unformatted part isn’t related to the PR. Should I rebase and run |
Yes, it's possible these files haven't been touched since the last formatter update. Rebasing and running |
…e localization handling
…mproved localization handling
…ng for improved localization handling" This reverts commit 8eb04b2.
…s multiple locales
… localization coverage
ebb31ee to
8727263
Compare
|
Looks like |
|
I've marked this PR as not ready to port to flutter/packages yet. |
|
If you would like to return to this, material_ui and cupertino_ui are now accepting contributions. :) |
|
Closing in favor of flutter/packages#13035 - ported to |
…tin digits (#13035) Port of flutter/flutter#186311, fixes flutter/flutter#85527 The time picker currently uses `int.parse` and `int.tryParse` to parse the entered number. However, in some locales, numbers are not represented using Latin digits, which causes the parsing to fail. In this implementation, I use `MaterialLocalizations` to parse the number directly, ensuring that it works correctly for all locales. A test has been added to ensure that the new implementation works as expected and does not cause any breaking changes. ## Pre-Review Checklist

The time picker currently uses
int.parseandint.tryParseto parse the entered number. However, in some locales, numbers are not represented using Latin digits, which causes the parsing to fail. In this implementation, I useMaterialLocalizationsto parse the number directly, ensuring that it works correctly for all locales.Fixes #85527
A test has been added to ensure that the new implementation works as expected and does not cause any breaking changes.
Pre-launch Checklist
///).