Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Class to slide a route horizontal from right to left.
class HorizontalSlidingPageRoute<T> extends MaterialPageRoute<T> {
HorizontalSlidingPageRoute({
WidgetBuilder builder,
RouteSettings settings: const RouteSettings(),
maintainState: true,
})
: super(builder: builder, settings: settings, maintainState: maintainState);
@override
Widget buildTransitions(BuildContext context, Animation<double> animation,
Animation<double> forwardAnimation, Widget child) {
return new SlideTransition(
position: new FractionalOffsetTween(
begin: FractionalOffset.topRight,
end: FractionalOffset.topLeft
).animate(animation),
child: child,
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.