-
Notifications
You must be signed in to change notification settings - Fork 28.5k
Text scale Cupertino nav bar large title and search field #167313
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
base: master
Are you sure you want to change the base?
Conversation
final double largeHeight = persistentHeight + _kNavBarLargeTitleHeightExtension; | ||
final double largeHeight = | ||
persistentHeight + | ||
MediaQuery.textScalerOf(context).scale(_kNavBarLargeTitleHeightExtension); |
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.
In my opinion, we shouldn't scale the whole navbar up linearly according to the text scale factor, since that will also scale up the gap in space between the navbar large title and the backbutton/tool bar icons, which is unnecessary to grow as large.
If you look at your native example, the top of "Settings" in the scaled up app is above "Settings" in the non-scaled app. But in your Flutter app "Lists" drifts further downwards when scaled up. This is because the space above is growing too much. Which can be a pain point for accessibility because when all the text on the screen is scaled larger, empty space is at a premium, and too much of it can cause text to overflow.
Can we find a ratio to apply to the text scale factor, when it's above 1.0, to limit this growth?
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.
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.
The title text between the large and middle version do look to me like they don't scale to the full amount, but they also aren't clamped. So they grow for the whole range but at a smaller degree.
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.
I think we might have to just clamp, it's not clear to me how to modify the scale factor directly with the TextScaler API and the textScaleFactor deprecation.
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.
You can still get the textScaleFactor, you just have to do it in a roundabout way, and we do that in places in the code:
final double textScaleFactor = |
It's kinda tedious.
This pull request has been changed to a draft. The currently pending flutter-gold status will not be able to resolve until a new commit is pushed or the change is marked ready for review again. 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. |
Fixes Cupertino nav bars should respect accessibility text scaling
Fixes Title jumps during a CupertinoNavigationBar -> CupertinoNavigationBar hero transition
Before
After
Native
Pre-launch Checklist
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.