Created
May 14, 2020 13:33
-
-
Save minikin/b614c0a82d9643ffdf5bff25a59c7492 to your computer and use it in GitHub Desktop.
MediaPlayerModalRoute
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
import 'package:flutter/material.dart'; | |
class MediaPlayerModalRoute extends PopupRoute<Widget> { | |
final WidgetBuilder builder; | |
final bool dismissible; | |
final String label; | |
final Color color; | |
MediaPlayerModalRoute({ | |
@required this.builder, | |
this.dismissible = true, | |
this.label, | |
this.color, | |
RouteSettings setting, | |
}) : super(settings: setting); | |
@override | |
Color get barrierColor => color; | |
@override | |
bool get barrierDismissible => dismissible; | |
@override | |
String get barrierLabel => label; | |
@override | |
Duration get transitionDuration => const Duration(milliseconds: 300); | |
@override | |
Widget buildPage( | |
BuildContext context, | |
Animation<double> animation, | |
Animation<double> secondaryAnimation, | |
) { | |
return builder(context); | |
} | |
@override | |
Widget buildTransitions( | |
BuildContext context, | |
Animation<double> animation, | |
Animation<double> secondaryAnimation, | |
Widget child, | |
) { | |
return FadeTransition( | |
opacity: animation, | |
child: ScaleTransition( | |
scale: animation, | |
child: child, | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment