Advertisement
Guest User

Route sliding transition

a guest
Jun 17th, 2019
484
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 1.07 KB | None | 0 0
  1. class EnterExitRoute extends PageRouteBuilder {
  2.   final Widget enterPage;
  3.   final Widget exitPage;
  4.   EnterExitRoute({this.exitPage, this.enterPage})
  5.       : super(
  6.     pageBuilder: (
  7.         BuildContext context,
  8.         Animation<double> animation,
  9.         Animation<double> secondaryAnimation,
  10.         ) =>
  11.     enterPage,
  12.     transitionsBuilder: (
  13.         BuildContext context,
  14.         Animation<double> animation,
  15.         Animation<double> secondaryAnimation,
  16.         Widget child,
  17.         ) =>
  18.         Stack(
  19.           children: <Widget>[
  20.             SlideTransition(
  21.               position: new Tween<Offset>(
  22.                 begin: const Offset(0.0, 0.0),
  23.                 end: const Offset(-1.0, 0.0),
  24.               ).animate(animation),
  25.               child: exitPage,
  26.             ),
  27.             SlideTransition(
  28.               position: new Tween<Offset>(
  29.                 begin: const Offset(1.0, 0.0),
  30.                 end: Offset.zero,
  31.               ).animate(animation),
  32.               child: enterPage,
  33.             ),
  34.           ],
  35.         ),
  36.   );
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement