-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Fix DropdownButtonFormField clips text when large text scale is used #159975
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix DropdownButtonFormField clips text when large text scale is used #159975
Conversation
|
@justinmc This fix will help to land #159328 because part of #159328 is trying to not break the test that this PR updates. Despite being titled "DropdownButtonFormField with isDense:true does not clip large scale text", the text in the previous test was clipped because of M3 line height so it leads to potential issues related to baseline (#159431). With this fix, #159328, can be simplified and might be easier to land. |
justinmc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍 . Good call doing this separately from #159328, hopefully it helps.
| final double fontSize = _textStyle!.fontSize ?? Theme.of(context).textTheme.titleMedium!.fontSize!; | ||
| final double scaledFontSize = MediaQuery.textScalerOf(context).scale(fontSize); | ||
| final double lineHeight = _textStyle!.height ?? Theme.of(context).textTheme.titleMedium!.height ?? 1.0; | ||
| final double scaledFontSize = MediaQuery.textScalerOf(context).scale(fontSize * lineHeight); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, I guess we just missed the lineHeight before.
|
@justinmc Are there many Google test failures? |
|
The Google test failures are relatively few, all of them are expected improvements that look just like your before/after screenshots, except for one where the dropdown appears to be open now when it was not before! Any thoughts on why that might happen? I wonder if it was a click that previously was outside of the dropdown, but now that the dropdown is slightly taller, the click hits it? Also of note, I don't see any instances where a reduced horizontal space has resulted in a change in the text displayed in the dropdown, like I noticed in #159328. That's good. If you can't think of any reason for the open dropdown, the next step might be for us to get in touch with the team that owns that test. |
|
Many thanks for the feedback. 🙏
The only reason which come to my mind is the one you described. This change can impact the dropdown height (normally only when bigger font or scale factor are used) so depending on how the test is written that can be a misclick, especially if there is several dropdowns in the same screen and each of them is taller than before. This is not a high priority issue, so I will mark it as a draft and we can revisit this after the holidays. |
571bf99 to
6733e13
Compare
|
@bleroux could you rebase this to fix the current failures? Thanks! |
6733e13 to
78bc81f
Compare
|
I'm planning to follow up on this next week. I've been trying to track down help and waiting to hear back. |
|
An affected Google test has been updated and I've started a re-run of the Google tests. I still expect the Google tests to fail, but hopefully they will all be expected failures this time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All Google test failures are expected, renewing my LGTM here 👍 . @bleroux feel free to merge when you're ready.
Manual roll requested by [email protected] flutter/flutter@b2f515f...c1561a4 2025-01-23 [email protected] Add `windows_host_engine_test` to presubmit, remove lint exceptions. (flutter/flutter#162032) 2025-01-23 [email protected] Shift `mac_clang_tidy` to a Linux orchestrator. (flutter/flutter#162042) 2025-01-23 [email protected] [Impeller] check both linear sampling props for AHBs. (flutter/flutter#162043) 2025-01-23 [email protected] [Impeller] Implement inherited opacity for ColorFilterContents (flutter/flutter#161834) 2025-01-23 [email protected] Keyboard tidy ups (flutter/flutter#162054) 2025-01-23 [email protected] fix: Call codec.dispose in tests of `engine/src/flutter` (flutter/flutter#161115) 2025-01-23 [email protected] fix: Call codec.dispose in `flutter/test` (flutter/flutter#161127) 2025-01-23 [email protected] fix: Call codec.dispose in `flutter_test` (flutter/flutter#161131) 2025-01-23 [email protected] fix: Call codec.dispose in `dev/` (flutter/flutter#161112) 2025-01-23 [email protected] Replace hacky code creating fake devices (flutter/flutter#162056) 2025-01-23 [email protected] [native assets] Roll dependencies (flutter/flutter#162068) 2025-01-23 [email protected] [native assets] Roll dependencies (flutter/flutter#162017) 2025-01-23 [email protected] Fix DropdownButtonFormField clips text when large text scale is used (flutter/flutter#159975) 2025-01-23 [email protected] Add a better error message when `flutter drive --target` is used incorrectly. (flutter/flutter#162023) 2025-01-23 [email protected] Revert "Move the analyzer_benchmark to Mac arm64 devicelab bots" (flutter/flutter#161822) 2025-01-23 [email protected] [Impeller] adjust coverage origin when rounding out SaveLayer bounds. (flutter/flutter#161838) 2025-01-23 [email protected] Add a README with instructions for editing and running tests for the FGP (flutter/flutter#161830) 2025-01-23 98614782+auto-submit[bot]@users.noreply.github.com Reverts "[Impeller] Migrate unit tests off of Skia geometry classes (#161855)" (flutter/flutter#162046) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…lutter#159975) ## Description This PR fixes `DropdownButtonFormField` text being clipped when using a large text scale. Before:  After:  This extend the fix from flutter#107201 which does not work properly with Material 3 (because of TextStyle.height being set for M3 default text styles). ## Related Issue Fixes [DropdownButtonFormField clips text when large text scale is used and useMaterial3 is true](flutter#159971) ## Tests Adds 1 test. Updates 1 test.
) Manual roll requested by [email protected] flutter/flutter@b2f515f...c1561a4 2025-01-23 [email protected] Add `windows_host_engine_test` to presubmit, remove lint exceptions. (flutter/flutter#162032) 2025-01-23 [email protected] Shift `mac_clang_tidy` to a Linux orchestrator. (flutter/flutter#162042) 2025-01-23 [email protected] [Impeller] check both linear sampling props for AHBs. (flutter/flutter#162043) 2025-01-23 [email protected] [Impeller] Implement inherited opacity for ColorFilterContents (flutter/flutter#161834) 2025-01-23 [email protected] Keyboard tidy ups (flutter/flutter#162054) 2025-01-23 [email protected] fix: Call codec.dispose in tests of `engine/src/flutter` (flutter/flutter#161115) 2025-01-23 [email protected] fix: Call codec.dispose in `flutter/test` (flutter/flutter#161127) 2025-01-23 [email protected] fix: Call codec.dispose in `flutter_test` (flutter/flutter#161131) 2025-01-23 [email protected] fix: Call codec.dispose in `dev/` (flutter/flutter#161112) 2025-01-23 [email protected] Replace hacky code creating fake devices (flutter/flutter#162056) 2025-01-23 [email protected] [native assets] Roll dependencies (flutter/flutter#162068) 2025-01-23 [email protected] [native assets] Roll dependencies (flutter/flutter#162017) 2025-01-23 [email protected] Fix DropdownButtonFormField clips text when large text scale is used (flutter/flutter#159975) 2025-01-23 [email protected] Add a better error message when `flutter drive --target` is used incorrectly. (flutter/flutter#162023) 2025-01-23 [email protected] Revert "Move the analyzer_benchmark to Mac arm64 devicelab bots" (flutter/flutter#161822) 2025-01-23 [email protected] [Impeller] adjust coverage origin when rounding out SaveLayer bounds. (flutter/flutter#161838) 2025-01-23 [email protected] Add a README with instructions for editing and running tests for the FGP (flutter/flutter#161830) 2025-01-23 98614782+auto-submit[bot]@users.noreply.github.com Reverts "[Impeller] Migrate unit tests off of Skia geometry classes (#161855)" (flutter/flutter#162046) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
) Manual roll requested by [email protected] flutter/flutter@b2f515f...c1561a4 2025-01-23 [email protected] Add `windows_host_engine_test` to presubmit, remove lint exceptions. (flutter/flutter#162032) 2025-01-23 [email protected] Shift `mac_clang_tidy` to a Linux orchestrator. (flutter/flutter#162042) 2025-01-23 [email protected] [Impeller] check both linear sampling props for AHBs. (flutter/flutter#162043) 2025-01-23 [email protected] [Impeller] Implement inherited opacity for ColorFilterContents (flutter/flutter#161834) 2025-01-23 [email protected] Keyboard tidy ups (flutter/flutter#162054) 2025-01-23 [email protected] fix: Call codec.dispose in tests of `engine/src/flutter` (flutter/flutter#161115) 2025-01-23 [email protected] fix: Call codec.dispose in `flutter/test` (flutter/flutter#161127) 2025-01-23 [email protected] fix: Call codec.dispose in `flutter_test` (flutter/flutter#161131) 2025-01-23 [email protected] fix: Call codec.dispose in `dev/` (flutter/flutter#161112) 2025-01-23 [email protected] Replace hacky code creating fake devices (flutter/flutter#162056) 2025-01-23 [email protected] [native assets] Roll dependencies (flutter/flutter#162068) 2025-01-23 [email protected] [native assets] Roll dependencies (flutter/flutter#162017) 2025-01-23 [email protected] Fix DropdownButtonFormField clips text when large text scale is used (flutter/flutter#159975) 2025-01-23 [email protected] Add a better error message when `flutter drive --target` is used incorrectly. (flutter/flutter#162023) 2025-01-23 [email protected] Revert "Move the analyzer_benchmark to Mac arm64 devicelab bots" (flutter/flutter#161822) 2025-01-23 [email protected] [Impeller] adjust coverage origin when rounding out SaveLayer bounds. (flutter/flutter#161838) 2025-01-23 [email protected] Add a README with instructions for editing and running tests for the FGP (flutter/flutter#161830) 2025-01-23 98614782+auto-submit[bot]@users.noreply.github.com Reverts "[Impeller] Migrate unit tests off of Skia geometry classes (#161855)" (flutter/flutter#162046) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Description
This PR fixes
DropdownButtonFormFieldtext being clipped when using a large text scale.Before:
After:
This extend the fix from #107201 which does not work properly with Material 3 (because of TextStyle.height being set for M3 default text styles).
Related Issue
Fixes DropdownButtonFormField clips text when large text scale is used and useMaterial3 is true
Tests
Adds 1 test.
Updates 1 test.