Created
December 12, 2018 06:32
-
-
Save nitishk72/adc3428991b655923bec5569a7202184 to your computer and use it in GitHub Desktop.
This file contains 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
import 'package:flutter/material.dart'; | |
// usage for this route | |
// Navigator.push(context, AppTransRoute(builder: (context) => new SecondPage(),),); | |
class AppTransRoute<T> extends MaterialPageRoute<T> { | |
AppTransRoute({WidgetBuilder builder, RouteSettings settings}) | |
: super(builder: builder, settings: settings); | |
@override | |
Widget buildTransitions(BuildContext context, Animation<double> animation, | |
Animation<double> secondaryAnimation, Widget child) { | |
if (settings.isInitialRoute) return child; | |
return new RotationTransition( | |
turns: animation, | |
child: new ScaleTransition( | |
scale: animation, | |
child: new FadeTransition( | |
opacity: animation, | |
child: child, | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment