Created
December 12, 2018 06:34
-
-
Save nitishk72/5eabb5f53c4a5f285a26174ef33cc897 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
// Usage | |
// Navigator.push(context,AppSlideRightRoute(widget: DetailScreen(),),); | |
class AppSlideRightRoute extends PageRouteBuilder { | |
final Widget widget; | |
AppSlideRightRoute({this.widget}) | |
: super( | |
pageBuilder: (BuildContext context, Animation<double> animation, | |
Animation<double> secondaryAnimation) { | |
return widget; | |
}, | |
transitionsBuilder: (BuildContext context, | |
Animation<double> animation, | |
Animation<double> secondaryAnimation, | |
Widget child) { | |
return new SlideTransition( | |
position: new Tween<Offset>( | |
begin: const Offset(-1.0, 0.0), | |
end: Offset.zero, | |
).animate(animation), | |
child: child, | |
); | |
}, | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment