@@ -181,6 +181,8 @@ class Hero extends StatefulWidget {
181181 this .flightShuttleBuilder,
182182 this .placeholderBuilder,
183183 this .transitionOnUserGestures = false ,
184+ this .curve = Curves .fastOutSlowIn,
185+ this .reverseCurve,
184186 required this .child,
185187 });
186188
@@ -264,6 +266,16 @@ class Hero extends StatefulWidget {
264266 /// Defaults to false.
265267 final bool transitionOnUserGestures;
266268
269+ /// The curve to use in the forward direction.
270+ ///
271+ /// Defaults to Curves.fastOutSlowIn.
272+ final Curve curve;
273+
274+ /// The curve to use in the reverse direction.
275+ ///
276+ /// If this property is null, the default, then curve.flipped is used.
277+ final Curve ? reverseCurve;
278+
267279 // Returns a map of all of the heroes in `context` indexed by hero tag that
268280 // should be considered for animation when `navigator` transitions from one
269281 // PageRoute to another.
@@ -460,10 +472,14 @@ class _HeroFlightManifest {
460472 CurvedAnimation ? _animation;
461473
462474 Animation <double > get animation {
475+ final Curve reverseCurve = (type == HeroFlightDirection .push) ?
476+ (toHero.widget.reverseCurve ?? toHero.widget.curve.flipped)
477+ : (fromHero.widget.reverseCurve ?? fromHero.widget.curve.flipped);
478+
463479 return _animation ?? = CurvedAnimation (
464480 parent: (type == HeroFlightDirection .push) ? toRoute.animation! : fromRoute.animation! ,
465- curve: Curves .fastOutSlowIn ,
466- reverseCurve: isDiverted ? null : Curves .fastOutSlowIn.flipped ,
481+ curve: (type == HeroFlightDirection .push) ? toHero.widget.curve : fromHero.widget.curve ,
482+ reverseCurve: isDiverted ? null : reverseCurve ,
467483 );
468484 }
469485
0 commit comments