fix: inconsistent horizontal spacing between hours and mins in time picker for non-english language#173706
Conversation
…icker for non-english language
|
It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging. If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group. |
There was a problem hiding this comment.
Code Review
This pull request addresses an inconsistent horizontal spacing issue in the time picker for non-English languages by changing the crossAxisAlignment of the hour and minute columns to CrossAxisAlignment.stretch. This change appears to correctly align the labels under the time input fields, ensuring they are centered like the text fields above them, regardless of the label's text length. The fix is simple and effective. My only suggestion is to add a test to prevent future regressions for this UI fix.
| Expanded( | ||
| child: Column( | ||
| crossAxisAlignment: CrossAxisAlignment.start, | ||
| crossAxisAlignment: CrossAxisAlignment.stretch, |
There was a problem hiding this comment.
This change correctly fixes the alignment of the hour and minute labels. To prevent future regressions, please consider adding a test case for this UI fix. A golden test in packages/flutter/test/material/time_picker_test.dart that uses a non-English locale (like Korean, as shown in the issue) would be ideal to verify that the labels are correctly centered.
There was a problem hiding this comment.
Here we see the glorious AI code review, which hallucinates that the example language in the issue is Korean. Locale('es') is Spanish 👏
…r non-english locale
|
@Jaineel-Mamtora If possible, can you add before/after screenshots to make the review easier? |
|
Golden file changes have been found for this pull request. Click here to view and triage (e.g. because this is an intentional change). If you are still iterating on this change and are not ready to resolve the images on the Flutter Gold dashboard, consider marking this PR as a draft pull request above. You will still be able to view image results on the dashboard, commenting will be silenced, and the check will not try to resolve itself until marked ready for review. For more guidance, visit Writing a golden file test for Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
|
Golden file changes are available for triage from new commit, Click here to view. For more guidance, visit Writing a golden file test for Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
|
@Jaineel-Mamtora Thanks for your effort. However, the baseline of the text does not fit. Now, the separator is below the text baseline. I think that fixing this issue is not just setting the Also, keep in mind that other languages have other separators, like |
@ManuelRauber, thanks for pointing them out. I'll try to fix the baseline issue. Further, upon investigating, it seems like the baselines in the Material 3 design docs for the input and the separator are inconsistent (pardon me, if that's not the case). Do we want to make the baseline consistent? Please check below screenshots for reference:
Please confirm which one should be considered as consistent. |
|
Golden file changes are available for triage from new commit, Click here to view. For more guidance, visit Writing a golden file test for Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
|
Golden file changes are available for triage from new commit, Click here to view. For more guidance, visit Writing a golden file test for Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
Indeed, according to the specs, at least in that screenshot, its also off. But since it's off in all of the screenshots, it might just be the intended way. My personal taste would be figure 2, the real baseline. But since Flutter material should respect the material design docs, it may be better to go for figure 1 instead. |
|
This pull request executed golden file tests, but it has not been updated in a while (20+ days). Test results from Gold expire after as many days, so this pull request will need to be updated with a fresh commit in order to get results from Gold. For more guidance, visit Writing a golden file test for Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
|
Gentle nudge @MitchellGoodwin (from triage) |
|
@Jaineel-Mamtora thank you for putting together this PR! Apologies for the late review. The approach looks reasonable, can you resolve the merge conflicts and rebase? The linux analyze check looks unrelated. Once it's all green again, I'm going to run Google testing on this PR just to see the golden file tests for Google apps using Flutter. I suspect that there might be some failures there that might show some odd behavior with real life use cases that we would want to address here. We may want to add some padding to make sure that the stretch doesn't stretch too far. |
…hours-mins-alignment
|
My sincere apologies 🥲. I was trying to merge the upstream changes in my forked branch. But, accidentally rebased it. I am a bit new to contributing to large repositories. Please let me know, in case I have wrongfully made any changes to any part of this codebase. |
|
No worries, it happens. And it seems like you fixed it. A lot of the time it's best to make a new PR a new branch with the changes, but that doesn't look necessary here. I removed the extra reviewers that got added. |
|
Golden file changes are available for triage from new commit, Click here to view. For more guidance, visit Writing a golden file test for Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
|
@Jaineel-Mamtora change LGTM, but I'm unable to rebase through github, as github says there is a conflict, though I do not see one. Could you try rebasing again? If it continues to act up, it might be easier to create a new branch with the changes, open a new PR, and request my review on that one. |
MitchellGoodwin
left a comment
There was a problem hiding this comment.
LGTM! I'm going to ask around for a second review.
QuncCccccc
left a comment
There was a problem hiding this comment.
From the screenshot attached, it seems the Hour and Minute box get wider. Could you help check if their widths are still 96? This is the specs: https://m3.material.io/components/time-pickers/specs#f2ce126b-9675-43a7-9314-b62eec57e2bd
Sure, let me check it today and I'll update. |
|
Hi @QuncCccccc, I checked, for the default locale, it has the same dimensions as mentioned in the material design docs. Please check below screenshot:
In case of other locale, for example, Spanish locale (es), the Period selector container (AM/PM) goes away, so it takes the available horizontal space as shown in below screenshot:
Please let me know your thoughts on this. |
I see. Thanks for checking! I think this looks okay! LGTM! |
|
autosubmit label was removed for flutter/flutter/173706, because - The status or check suite Google testing has failed. Please fix the issues identified (or deflake) before re-applying this label. |









This PR aims to fix an open issue: #173621
Pre-launch Checklist
///).Screenshots
Please find below the before and after screenshots