2023-07-29 02:17:26 +00:00
|
|
|
import 'package:flutter/widgets.dart';
|
|
|
|
import 'package:freezer/page_routes/basic_page_route.dart';
|
|
|
|
import 'package:freezer/ui/animated_blur.dart';
|
|
|
|
|
|
|
|
class BlurSlidePageRoute<T> extends BasicPageRoute<T> {
|
|
|
|
final WidgetBuilder builder;
|
|
|
|
final Curve animationCurve;
|
|
|
|
final _animationTween = Tween(
|
|
|
|
begin: const Offset(0.0, 1.0),
|
|
|
|
end: Offset.zero,
|
|
|
|
);
|
|
|
|
|
|
|
|
BlurSlidePageRoute({
|
|
|
|
required this.builder,
|
|
|
|
this.animationCurve = Curves.linearToEaseOut,
|
2023-10-12 22:09:37 +00:00
|
|
|
super.transitionDuration,
|
|
|
|
super.maintainState,
|
|
|
|
super.settings,
|
|
|
|
});
|
2023-07-29 02:17:26 +00:00
|
|
|
|
|
|
|
@override
|
|
|
|
Widget buildPage(BuildContext context, Animation<double> animation,
|
|
|
|
Animation<double> secondaryAnimation) =>
|
|
|
|
builder(context);
|
|
|
|
|
|
|
|
@override
|
2023-10-12 22:09:37 +00:00
|
|
|
Widget buildTransitions(BuildContext context, Animation<double> animation,
|
2023-07-29 02:17:26 +00:00
|
|
|
Animation<double> secondaryAnimation, Widget child) {
|
2023-10-12 22:09:37 +00:00
|
|
|
final a = CurvedAnimation(parent: animation, curve: animationCurve);
|
2023-07-29 02:17:26 +00:00
|
|
|
return Stack(children: [
|
|
|
|
Positioned.fill(
|
|
|
|
child: AnimatedBlur(
|
2023-10-12 22:09:37 +00:00
|
|
|
animation: a, multiplier: 10.0, child: const SizedBox()),
|
2023-07-29 02:17:26 +00:00
|
|
|
),
|
2023-10-12 22:09:37 +00:00
|
|
|
SlideTransition(position: _animationTween.animate(a), child: child),
|
2023-07-29 02:17:26 +00:00
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|