Skip to content

Instantly share code, notes, and snippets.

@itskgore
Created May 7, 2020 10:38
Show Gist options
  • Save itskgore/1e0270258d341b6f90137972a21a593a to your computer and use it in GitHub Desktop.
Save itskgore/1e0270258d341b6f90137972a21a593a to your computer and use it in GitHub Desktop.
Slide in navigation effect using flutter
class DownSlideNavigation extends PageRouteBuilder {
final Widget widget;
DownSlideNavigation({this.widget})
: super(
transitionDuration: Duration(milliseconds: 500),
transitionsBuilder: (BuildContext con, Animation<double> animation,
Animation<double> animationDuration, Widget child) {
animation =
CurvedAnimation(parent: animation, curve: Curves.easeInOut);
return SlideTransition(
transformHitTests: true,
position:
Tween<Offset>(begin: const Offset(-1, 0), end: Offset.zero)
.chain(CurveTween(curve: Curves.ease))
.animate(animation),
textDirection: TextDirection.ltr,
child: child,
);
},
pageBuilder: (BuildContext context, Animation<double> animation,
Animation<double> animationDuration) {
return widget;
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment