Skip to content

Instantly share code, notes, and snippets.

@Norbert515
Created February 24, 2018 10:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Norbert515/9960e121f9c3ad3906a4d75b3c261925 to your computer and use it in GitHub Desktop.
Save Norbert515/9960e121f9c3ad3906a4d75b3c261925 to your computer and use it in GitHub Desktop.
fade route
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