Skip to content

Instantly share code, notes, and snippets.

@itskgore
Last active May 7, 2020 10:42
Show Gist options
  • Save itskgore/558dbbcd0a711413439e737ce4f78348 to your computer and use it in GitHub Desktop.
Save itskgore/558dbbcd0a711413439e737ce4f78348 to your computer and use it in GitHub Desktop.
Slide in screen navigation effect in flutter
class SlideNavigation extends PageRouteBuilder {
final Widget widget;
SlideNavigation({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(0, -1), end: Offset.zero)
.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