Created
February 21, 2018 11:53
-
-
Save slightfoot/9f76c9f5d04281df2f69ad9448bf6317 to your computer and use it in GitHub Desktop.
FadeRoute
This file contains hidden or 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> { | |
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