Created
April 17, 2017 19:44
-
-
Save LucWollants/ce317631c56b50354a2bf18e2a91ee3f to your computer and use it in GitHub Desktop.
Class to slide a route horizontal from right to left.
This file contains hidden or 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
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