这是indexloc提供的服务,不要输入任何密码
Skip to content

Cupertino navigation bars transitionBetweenRoutes fidelity update #164956

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

Merged
merged 22 commits into from
Mar 20, 2025

Conversation

victorsanni
Copy link
Contributor

@victorsanni victorsanni commented Mar 11, 2025

In the before Flutter video, drag happens after the 17 second mark.

Flutter before

Flutter.before.mov

Flutter after

Flutter.after.4.mov

Flutter back swipe drag gesture

flutter.after.drag.2.mov

Native iOS

native.mov

Flutter scaled back chevron and large title after

flutter.scaled.and.label.mov

Native iOS scaled back chevron and large title

native.scaled.back.chevron.mov

Native iOS is probably using a spring simulation. This is the closest curve we have to the native transition, but should be updated in the future with the exact values.

Fixes Cupertino navigation bars transitionBetweenRoutes fidelity update

@github-actions github-actions bot added framework flutter/packages/flutter repository. See also f: labels. f: cupertino flutter/packages/flutter/cupertino repository labels Mar 11, 2025
@victorsanni victorsanni marked this pull request as ready for review March 11, 2025 18:50
Copy link
Contributor

@MitchellGoodwin MitchellGoodwin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks MUCH better.

);

Widget child = bottomNavBarBottom.child;
final Curve animationCurve =
animation.status == AnimationStatus.forward
? Curves.easeOutQuart
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The forward case looks a little fast. Ideally, the navbar contents would not go ahead of the content behind it, I think it's a little distracting. The reverse case looks good, in my opinion.

It looks like the Hero widget applies it's own curve as well. Is that interfering at all?

How does this look when dragging the whole time? As long as the drag gesture is still active, the base curve of the transition is linear.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The forward case looks a little fast. Ideally, the navbar contents would not go ahead of the content behind it, I think it's a little distracting. The reverse case looks good, in my opinion.

yeah it feels too fast and the fact that it goes ahead of the content makes it look bad visually, especially when manually dragging to pop a page.

I also found a bug when swiping between pages, if I start swiping from the furthest point the large title doesn't start animating immediately creating an unpleasing visual bug, but if I start swiping to pop from a point far from the edge it animates as expected, here's a screen recording of this behaviour:

screen recording

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also found a bug when swiping between pages, if I start swiping from the furthest point the large title doesn't start animating immediately creating an unpleasing visual bug, but if I start swiping to pop from a point far from the edge it animates as expected, here's a screen recording of this behaviour

That's likely because the page transition is on a linear curve during the drag, while the navbar is still on a flipped easeOutQuart curve.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible for the header to simply follow the content's x coordinate? If we can't get the exact curve then simply doing this should be acceptable.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible for the header to simply follow the content's x coordinate? If we can't get the exact curve then simply doing this should be acceptable.

I also thought of this, it sounds like a reasonable thing to do if the curve requires lots of work to look somewhat right, also since this is a temporary change and will be tweaked again as mentioned in the issue description to use a spring simulation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried all the curves we have, none of them could follow the content. There's something funky happening behind the scenes that I can't put a finger on. @MitchellGoodwin mentioned that the Hero might be applying its own curve, maybe that's why.

Either way I used custom curves to approximate the native animation.

Copy link

@MaherSafadii MaherSafadii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it look more polished now, looks good for when there's only a large title, but with the search field not so much, can you make the search field that's on the page that's getting another page pushed on to (the previous page), slide with the same curve as the pages content because currently there a lot of overlapping happening with them especially when manually dragging, things are feeling better overall, the pushed title felt flimsy before this pr now it feels snappy which is good.

);

Widget child = bottomNavBarBottom.child;
final Curve animationCurve =

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the title being ahead of the page looks jarring, maybe a custom animation curve could be used instead of the current built-in ones if they can't match current needs, because it seems like it needs a very specific curve, based on my observation of the native side, maybe you can use the base of the curve that the page content animates in, but tweak it a bit, make it slightly slower at the beginning and faster at the end but not to fast to the point where it doesn't overflow out of the page's content.

);

Widget child = bottomNavBarBottom.child;
final Curve animationCurve =
animation.status == AnimationStatus.forward
? Curves.easeOutQuart

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible for the header to simply follow the content's x coordinate? If we can't get the exact curve then simply doing this should be acceptable.

I also thought of this, it sounds like a reasonable thing to do if the curve requires lots of work to look somewhat right, also since this is a temporary change and will be tweaked again as mentioned in the issue description to use a spring simulation.

Copy link

@MaherSafadii MaherSafadii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks awesome now, the curves are snappy like native and aren't overlapping aggressively like before, the bug where if you start swiping to pop from the devices border is still present, the title doesn't start animating until you swipe a longer distance, also the the large title when animating to the previous page title in the back button needs updating now seems it needs to match the speed the large title that's entering and leaving, other than that, everything looks and works fine.

Copy link
Contributor

@MitchellGoodwin MitchellGoodwin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have one concern on the type checking but other than that, LGTM. I think this looks so much better now. It would probably be better to readdress the spring simulations first before polishing this further.

// The bottom widget animates linearly during a backswipe by a user gesture.
userGestureInProgress
// The parent of the hero animation, which is the route animation.
? (animation as CurvedAnimation).parent
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should check to see if it is a CurvedAnimation. That way if it changes in the Hero implementation in the future, this doesn't break.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we check or assert?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question. I think assert would be better, so this code doesn't just hang around if that happens.

// The large title animates linearly during a backswipe by a user gesture.
userGestureInProgress
// The parent of the hero animation, which is the route animation.
? (animation as CurvedAnimation).parent
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

@MaherSafadii
Copy link

just checked the latest changes and it looks good, I also agree with Mitchels comment:

It would probably be better to readdress the spring simulations first before polishing this further.

things look good so far, it isn't worth putting more effort to match the native side down to the smallest detail if it's going to be revisited and get implemented with a spring simulation sometime later.

@MaherSafadii
Copy link

can you make it that the chevron finishes animating as soon as the page push animation finishes because currently it starts animating when the push animation finishes unlike native.

Copy link
Contributor

@dkwingsmt dkwingsmt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you!

engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 27, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 27, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 27, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 27, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 28, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 28, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 28, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 28, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 29, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 29, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 30, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 30, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 31, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 31, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 31, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 31, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 31, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 31, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 31, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 1, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 1, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 1, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 1, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 20, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 20, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 21, 2025
zhangyuang pushed a commit to zhangyuang/flutter-fork that referenced this pull request Jun 9, 2025
…utter#164956)

In the before Flutter video, drag happens after the 17 second mark.

## Flutter before


https://github.com/user-attachments/assets/9fbcd59e-68aa-4975-9a66-f05e72071223


## Flutter after



https://github.com/user-attachments/assets/784d7f46-a8ce-4e5f-a849-3b19df6668c9



## Flutter back swipe drag gesture



https://github.com/user-attachments/assets/09d38c01-aeea-46c1-90b4-590861f8f3a2




## Native iOS


https://github.com/user-attachments/assets/f2ab96c0-766b-4452-b6d5-3f92e6b6785f

## Flutter scaled back chevron and large title after


https://github.com/user-attachments/assets/ba87add7-affa-4dcc-b2f0-abbc3487d677






## Native iOS scaled back chevron and large title


https://github.com/user-attachments/assets/5c7bfe5b-5789-4ab9-8e36-770cf802b1b1



Native iOS is probably using a spring simulation. This is the closest
curve we have to the native transition, but should be updated in the
future with the exact values.

Fixes [Cupertino navigation bars transitionBetweenRoutes fidelity
update](flutter#164662)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
f: cupertino flutter/packages/flutter/cupertino repository framework flutter/packages/flutter repository. See also f: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cupertino navigation bars transitionBetweenRoutes fidelity update
4 participants