Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class EnterExitRoute extends PageRouteBuilder {
- final Widget enterPage;
- final Widget exitPage;
- EnterExitRoute({this.exitPage, this.enterPage})
- : super(
- pageBuilder: (
- BuildContext context,
- Animation<double> animation,
- Animation<double> secondaryAnimation,
- ) =>
- enterPage,
- transitionsBuilder: (
- BuildContext context,
- Animation<double> animation,
- Animation<double> secondaryAnimation,
- Widget child,
- ) =>
- Stack(
- children: <Widget>[
- SlideTransition(
- position: new Tween<Offset>(
- begin: const Offset(0.0, 0.0),
- end: const Offset(-1.0, 0.0),
- ).animate(animation),
- child: exitPage,
- ),
- SlideTransition(
- position: new Tween<Offset>(
- begin: const Offset(1.0, 0.0),
- end: Offset.zero,
- ).animate(animation),
- child: enterPage,
- ),
- ],
- ),
- );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement