-
Notifications
You must be signed in to change notification settings - Fork 29.7k
WIP - [Android 10] Added zooming page transition #40258
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
Conversation
|
As this will be the default behavior for Android 10+ versions, should this be the default behavior in the Material library? |
|
It was mentioned in #39812 that the ideal behaviour would be to automatically detect the Android version and then switch the |
|
I had looked into this transition very recently. Here's what I came up with. The "fastOutExtraSlowIn" curve used to animate is defined like this: <pathInterpolator xmlns:android="http://schemas.android.com/apk/res/android"
android:pathData="M 0,0 C 0.05, 0, 0.133333, 0.06, 0.166666, 0.4 C 0.208333, 0.82, 0.25, 1, 1, 1"/>This curve is used to animate the scale of the incoming page from 85% to 100% over 400ms. The outgoing route is scaled with the same curve and duration, from 100% to 105%. You can see what fastOutExtraSlowIn curve looks like by pasting the following into svgpad: <svg version="1.1" x="0px" y="0px" width="400px" height="400px" viewBox="0 -1 1 1">
<g transform="scale(1,-1)">
<rect x="0" y="0" height="1" width="1" stroke="lightgrey" fill="none" stroke-width="0.01"/>
<path d="M 0,0 C 0.05, 0, 0.133333, 0.06, 0.166666, 0.4 C 0.208333, 0.82, 0.25, 1, 1, 1" stroke="black" fill="none" stroke-width="0.005" />
</svg>The curve can be approximated with a TweenSequence: final TweenSequence<double> scaleCurveSequence = TweenSequence<double>(
<TweenSequenceItem<double>>[
TweenSequenceItem<double>(
tween: Tween<double>(begin: 0.0, end: 0.4)
.chain(CurveTween(curve: Cubic(0.05, 0.0, 0.133333, 0.06))),
weight: 0.166666,
),
TweenSequenceItem<double>(
tween: Tween<double>(begin: 0.4, end: 1.0)
.chain(CurveTween(curve: Cubic(0.208333, 0.82, 0.25, 1.0))),
weight: 1 - 0.166666,
),
],
);The scale animations can be defined like this, and used with a ScaleTransition. Animation<double> incomingScaleAnimation = Tween<double>(begin: 0.85, end: 1.0)
.chain(scaleCurveSequence)
.animate(_controller);
Animation<double> outgoingScaleAnimation = Tween<double>(begin: 1.0, end: 1.05)
.chain(scaleCurveSequence)
.animate(_controller); |
|
Here's a video of the transition with the new curve sequence: Google Drive |
|
I am having some trouble making a flipped version of this sequence. I want to flip the acceleration when reversing the transition. With a regular static final TweenSequence<double> _scaleCurveSequence = TweenSequence<double>(
<TweenSequenceItem<double>>[
TweenSequenceItem<double>(
tween: Tween<double>(begin: 0.0, end: 0.4)
.chain(CurveTween(curve: _scaleCurveBeginning)),
weight: 0.166666,
),
TweenSequenceItem<double>(
tween: Tween<double>(begin: 0.4, end: 1.0)
.chain(CurveTween(curve: _scaleCurveEnd)),
weight: 1.0 - 0.166666,
),
],
); |
|
Hi @Salby, the backwards transition for this isn't simply the flipped implementation of the forwards transition curve. It still uses the |
|
Some other details that we missed out previously: Backward transition Edit: Let me know if you have any more clarification questions about the details of the transition, and I'll do my best to clear up any confusion. |
|
I am having some trouble with the backward transition. Since I'm not in control of the The other transitions are built like this, they just take two Another solution might be to make Edit: This is how the transition looks currently: Google drive. |
|
Hi @Salby, I've been out for a little over a week and might be out for up to another week. When |
|
I've started looking into working on the transition as well -- I'm currently stuck on the same piece as you and trying to reverse the |
|
I will close this issue since my PR with the Zoom transition has been merged. Thank you so much for your initial contribution! |


Description
Adds a new transitions builder imitating the new default page transition in Android 10/Q. The default transition is still the old
FadeUpwardsPageTransitionsBuilder, so you have to manually set thepageTransitionsThemelike this:Video of this transition in action: Google Drive
Related Issues
Tests
I added the following tests:
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]). This will ensure a smooth and quick review process.///).flutter analyze --flutter-repo) does not report any problems on my PR.Breaking Change
Does your PR require Flutter developers to manually update their apps to accommodate your change?