-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Add CupertinoSliverNavigationBar large title magnification on over scroll #103299
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
Add CupertinoSliverNavigationBar large title magnification on over scroll #103299
Conversation
| child: Transform.scale( | ||
| // This scale is estimated from the settings app in iOS 14. | ||
| // It has a maximum magnification of about 15%. | ||
| scale: math.min( |
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.
@LongCatIsLooong would you mind looking at this review? It's the same as https://github.com/flutter/flutter/pull/72100/files#r540634692 except the comment and tests, and the logic went from
math.max(1.0, math.min(1.15, 1 + (constraints.maxHeight - maxExtent) / maxExtent * 0.12))
to
math.min(1.15, 1 + (constraints.maxHeight - maxExtent) / maxExtent * 0.12)
From the other review Daniel got stuck here:
I'm having trouble setting the max-width condition for the scale transformation. My original thought was to have a condition that would check for the width of the large title and ensure it's less than the nav bar builder's constraints.maxWidth, but I can't find a way to get the width of the large title text itself. Any ideas?
And @xster said:
The canonical way is to use a RenderBox the way the FittedBox object uses a RenderBox. During the layout phase, it lets its child calculate its size then reacts accordingly in its own paint.
The slightly less complicated way is to "dry run" it using a TextPainter. There's a bit of that going on in the picker.
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.
It seems when the scale reaches 1.15 there's nothing preventing a jumbo title from getting clipped?
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.
also when the scroll view isn't overscrolling, it's possible that we have constraints.maxHeight < maxExtent, so clamping is still necessary.
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 another option is to give the large title widget a modified width constraint, such that newConstraints.maxWith == constraints.maxWidth/1.15, so when it expends it won't exceed the original max width.
Co-authored-by: Jenn Magder <[email protected]>
This is copy of PR #72100 with added tests.
Per #62298, adds magnification for CupertinoSliverNavigationBar large title on over scroll.
Fixes #62298
Pre-launch Checklist
///).