Skip to content

Conversation

@xster
Copy link
Member

@xster xster commented Mar 31, 2017

For #8726.

Diffbases against #9059. View the diff only via https://github.com/xster/flutter/compare/mountainview...xster:cupertino-transition?diff=split&name=cupertino-transition

  • Makes the standard Cupertino transition come in from the right while parallaxing the screen behind the incoming one
  • Refactor away the custom Cupertino transition curves. Get rid of the math since only the person that wrote it can understand it :). Use composition instead
  • Add a fullscreen dialog route mode where the screen comes in from the bottom in Cupertino. Can't be used in named routes yet
  • Fixed the fullscreen dialog gallery to use the new mode
  • Moved material tests from widget to material. Wrote a bunch of more tests
  • Appbar parallax blending effect will be in a next PR

}
}

/// An animation of [double]s that tracks the sum of two given animations.
Copy link
Contributor

Choose a reason for hiding this comment

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

if we're going to just provide this class, we should change the example at CompoundAnimation to be an example we don't actually provide :-)

Copy link
Contributor

Choose a reason for hiding this comment

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

looks like you don't need this class after all so you can remove it and get away without changing the example. :-)

Copy link
Member Author

Choose a reason for hiding this comment

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

ya, reverted. Thanks

@required Animation<double> outgoingRouteAnimation,
@required this.child,
})
: incomingPositionAnimation = _kRightMiddleTween.animate(
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: the : should be one space to the right of the ) on the same line

Copy link
Member Author

Choose a reason for hiding this comment

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

Did something. Hope it's right

CupertinoPageTransition({
Key key,
// Linear route animation from 0.0 to 1.0 when this screen is being pushed.
@required Animation<double> incomingRouteAnimation,
Copy link
Contributor

Choose a reason for hiding this comment

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

i'm not sure incoming/outgoing really captures the semantics of these two animations, but i don't have a better suggestion. :-(

Copy link
Member Author

Choose a reason for hiding this comment

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

Let's figure it out in #9132 then I'll go rename everything.

key: key,
// Trigger a rebuild whenever any animation route happens. The listenable's value is not
// used.
listenable: new AnimationSum(left: incomingRouteAnimation, right: outgoingRouteAnimation),
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

yay! so much more readable! I was hoping there was something like this

Copy link
Member Author

Choose a reason for hiding this comment

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

Done. Thanks!

// Fractional offset from fully on screen to 1/3 offscreen to the left.
static final FractionalOffsetTween _kMiddleLeftTween = new FractionalOffsetTween(
begin: FractionalOffset.topLeft,
end: const FractionalOffset(-0.33, 0.0),
Copy link
Contributor

Choose a reason for hiding this comment

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

you can do -1.0/3.0 to more precisely capture "one third"

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

);

// Fractional offset from offscreen to the right to fully on screen.
static final FractionalOffsetTween _kRightMiddleTween = new FractionalOffsetTween(
Copy link
Contributor

Choose a reason for hiding this comment

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

can these be const?

Copy link
Member Author

Choose a reason for hiding this comment

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

Might not fully understand dart const constructors. Don't think one is defined for fractional offset tween though.

),
);

static final FractionalOffsetTween _kBottomUpTween = new FractionalOffsetTween(
Copy link
Contributor

Choose a reason for hiding this comment

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

const?

Copy link
Member Author

Choose a reason for hiding this comment

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

ditto

assert(controller != null);
}

AnimationController controller;
Copy link
Contributor

Choose a reason for hiding this comment

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

presumably this should be final?

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, done in diffbase PR

if (!(nextRoute is MaterialPageRoute<dynamic>))
return false;
final MaterialPageRoute<dynamic> nextMaterialPageRoute = nextRoute;
// Don't perform outgoing animation if the next route is a fullscreen dialog.
Copy link
Contributor

Choose a reason for hiding this comment

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

nice

Copy link
Member Author

Choose a reason for hiding this comment

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

Though I had to implement new APIs on the page route for a sec until I remembered you mentioned it in #5690 (comment)

await tester.pump(const Duration(milliseconds: 1));

final Opacity widget2Opacity =
Opacity widget2Opacity =
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: i don't think this newline really help readability since it makes this line not match the others

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, fits in one line now. Done.

@Hixie
Copy link
Contributor

Hixie commented Apr 1, 2017

This is fantastic. LGTM.

final MaterialPageRoute<dynamic> nextMaterialPageRoute = nextRoute;
// Don't perform outgoing animation if the next route is a fullscreen dialog.
return !nextMaterialPageRoute.fullscreenDialog;
return nextRoute is MaterialPageRoute && !nextRoute.fullscreenDialog;
Copy link
Contributor

Choose a reason for hiding this comment

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

ah, neat. I can never figure out when this works and when it doesn't. :-(

key: key,
// Trigger a rebuild whenever any of the 2 animation route happens.
listenable: new Listenable.merge(
<Listenable> [incomingRouteAnimation, outgoingRouteAnimation]
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: no space between type and bracket

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

xster added 4 commits April 3, 2017 11:56
# Conflicts:
#	packages/flutter/lib/src/cupertino/page.dart
…ansition

# Conflicts:
#	packages/flutter/lib/src/cupertino/page.dart
#	packages/flutter/lib/src/material/page.dart
@xster xster merged commit 58ddde8 into flutter:master Apr 3, 2017
@xster xster deleted the cupertino-transition branch April 3, 2017 19:44
@Hixie
Copy link
Contributor

Hixie commented Apr 4, 2017

This made the flutter_gallery_ios__transition_perf average_frame_build_time_millis benchmark regress substantially.

@Hixie
Copy link
Contributor

Hixie commented Apr 4, 2017

Also microbenchmarks_ios stock_build_iteration.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants