Skip to content

Instantly share code, notes, and snippets.

@slightfoot
Created February 21, 2018 11:53
Show Gist options
  • Save slightfoot/9f76c9f5d04281df2f69ad9448bf6317 to your computer and use it in GitHub Desktop.
Save slightfoot/9f76c9f5d04281df2f69ad9448bf6317 to your computer and use it in GitHub Desktop.
FadeRoute
class FadeRoute<T> extends MaterialPageRoute<T> {
final bool fadeInitialRoute;
FadeRoute({ builder, settings, maintainState, fullscreenDialog, this.fadeInitialRoute = true})
: super(builder: builder, settings: settings, maintainState: maintainState, fullscreenDialog: fullscreenDialog);
@override
bool get opaque => false;
@override
Widget buildTransitions(_, Animation<double> animation, __, Widget child) {
if (settings.isInitialRoute && !fadeInitialRoute) {
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