Skip to content

Instantly share code, notes, and snippets.

@TechieBlossom
Created November 15, 2019 20:07
Show Gist options
  • Save TechieBlossom/12dd33b73bd7c93c4338af56126f1913 to your computer and use it in GitHub Desktop.
Save TechieBlossom/12dd33b73bd7c93c4338af56126f1913 to your computer and use it in GitHub Desktop.
import 'package:flutter/widgets.dart';
class FadePageRoute extends PageRouteBuilder {
final Widget widget;
FadePageRoute({this.widget})
: super(
pageBuilder: (
BuildContext context,
Animation<double> animation,
Animation<double> secondaryAnimation,
) {
return widget;
},
transitionsBuilder: ((
BuildContext context,
Animation<double> animation,
Animation<double> secondaryAnimation,
Widget child,
) {
return FadeTransition(
opacity: Tween(begin: 0.0, end: 1.0).animate(animation),
child: child,
);
}),
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment