In PageRouteBuilder's transitionBuilder method I'm using the code bellow but the secondary animation is ALWAYS the reverse of the animation. How can we have a slide in transition on a page and fade out on exit?
Widget leftToRightSlideTransition(context, animation, secondaryAnimation, child) {
final Tween<double> doubleTween = Tween<double>(begin: 1.0, end: 0.0);
final Animation<double> animDouble = doubleTween.animate(secondaryAnimation);
final fadeTransition = FadeTransition(opacity: animDouble, child: child);
var begin = Offset(-1.0, 0.0);
var end = Offset.zero;
var tween = Tween(begin: begin, end: end).chain(
CurveTween(curve: Curves.easeIn),
);
return SlideTransition(
position: tween.animate(animation),
child: fadeTransition,
);
}