import 'package:flutter/widgets.dart'; import 'package:freezer/page_routes/basic_page_route.dart'; import 'package:freezer/ui/animated_blur.dart'; class BlurSlidePageRoute extends BasicPageRoute { 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, super.transitionDuration, super.maintainState, super.settings, }); @override Widget buildPage(BuildContext context, Animation animation, Animation secondaryAnimation) => builder(context); @override Widget buildTransitions(BuildContext context, Animation animation, Animation secondaryAnimation, Widget child) { final a = CurvedAnimation(parent: animation, curve: animationCurve); return Stack(children: [ Positioned.fill( child: AnimatedBlur( animation: a, multiplier: 10.0, child: const SizedBox()), ), SlideTransition(position: _animationTween.animate(a), child: child), ]); } }