Skip to content

Instantly share code, notes, and snippets.

@nitishk72
Created December 12, 2018 06:34
Show Gist options
  • Save nitishk72/5eabb5f53c4a5f285a26174ef33cc897 to your computer and use it in GitHub Desktop.
Save nitishk72/5eabb5f53c4a5f285a26174ef33cc897 to your computer and use it in GitHub Desktop.
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