Add CupertinoSliverNavigationBar large title magnification on over scroll#103299
Add CupertinoSliverNavigationBar large title magnification on over scroll#103299ivirtex wants to merge 5 commits intoflutter:masterfrom ivirtex:cupertino-sliver-nav-bar-magnification
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.
@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.
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.
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.
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
///).