mirror of
https://github.com/johrpan/christmas_cats.git
synced 2025-10-28 19:27:25 +01:00
Version 0.1.0
This commit is contained in:
commit
5dda59a6cd
73 changed files with 5741 additions and 0 deletions
45
lib/widgets/transparent_route.dart
Normal file
45
lib/widgets/transparent_route.dart
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
// This is a modified version of MaterialPageRoute that we can't extend without
|
||||
// hitting an assertion.
|
||||
class TransparentRoute<T> extends PageRoute<T> {
|
||||
final Widget Function(BuildContext context) builder;
|
||||
|
||||
MaterialPageRoute route;
|
||||
|
||||
TransparentRoute({
|
||||
this.builder,
|
||||
});
|
||||
|
||||
@override
|
||||
bool get opaque => false;
|
||||
|
||||
@override
|
||||
Color get barrierColor => null;
|
||||
|
||||
@override
|
||||
String get barrierLabel => null;
|
||||
|
||||
@override
|
||||
bool get maintainState => true;
|
||||
|
||||
@override
|
||||
Duration get transitionDuration => Duration(milliseconds: 300);
|
||||
|
||||
@override
|
||||
Widget buildPage(BuildContext context, Animation<double> animation,
|
||||
Animation<double> secondaryAnimation) {
|
||||
final result = builder(context);
|
||||
return Semantics(
|
||||
scopesRoute: true,
|
||||
explicitChildNodes: true,
|
||||
child: result,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget buildTransitions(BuildContext context, Animation<double> animation, Animation<double> secondaryAnimation, Widget child) {
|
||||
final PageTransitionsTheme theme = Theme.of(context).pageTransitionsTheme;
|
||||
return theme.buildTransitions<T>(this, context, animation, secondaryAnimation, child);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue