Created
February 24, 2018 10:31
-
-
Save Norbert515/9960e121f9c3ad3906a4d75b3c261925 to your computer and use it in GitHub Desktop.
fade route
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
class FadeRoute<T> extends MaterialPageRoute<T> { | |
FadeRoute({ 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; | |
// Fades between routes. (If you don't want any animation, | |
// just return child.) | |
return new FadeTransition(opacity: animation, child: child); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment