From 243b4c065be318adb530f3a2d03c1b4938405269 Mon Sep 17 00:00:00 2001 From: Hans Muller Date: Fri, 19 Aug 2016 10:01:14 -0700 Subject: [PATCH] Ease Material route animations (#5487) --- packages/flutter/lib/src/material/page.dart | 7 +++++-- packages/flutter/lib/src/widgets/heroes.dart | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/flutter/lib/src/material/page.dart b/packages/flutter/lib/src/material/page.dart index 35939b789d..f77711bc72 100644 --- a/packages/flutter/lib/src/material/page.dart +++ b/packages/flutter/lib/src/material/page.dart @@ -18,8 +18,11 @@ class _MaterialPageTransition extends AnimatedWidget { this.child }) : super( key: key, - animation: _kMaterialPageTransitionTween.animate(new CurvedAnimation(parent: animation, curve: Curves.fastOutSlowIn)) - ); + animation: _kMaterialPageTransitionTween.animate(new CurvedAnimation( + parent: animation, // The route's linear 0.0 - 1.0 animation. + curve: Curves.fastOutSlowIn + ) + )); final Widget child; diff --git a/packages/flutter/lib/src/widgets/heroes.dart b/packages/flutter/lib/src/widgets/heroes.dart index a1f9825a06..a4ce350920 100644 --- a/packages/flutter/lib/src/widgets/heroes.dart +++ b/packages/flutter/lib/src/widgets/heroes.dart @@ -447,7 +447,7 @@ class HeroController extends NavigatorObserver { if (previousRoute is PageRoute) // could be null _from = previousRoute; _to = route; - _animation = route.animation; + _animation = new CurvedAnimation(parent: route.animation, curve: Curves.fastOutSlowIn); _checkForHeroQuest(); } } @@ -461,7 +461,7 @@ class HeroController extends NavigatorObserver { if (previousRoute is PageRoute) { _to = previousRoute; _from = route; - _animation = route.animation; + _animation = new CurvedAnimation(parent: route.animation, curve: Curves.fastOutSlowIn); _checkForHeroQuest(); } }