Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-12-25 13:43:20 +08:00
parent 161bf2eedb
commit 20a36e8f9a
97 changed files with 596 additions and 436 deletions

View File

@@ -31,6 +31,18 @@ class HeroDialogRoute<T> extends PageRoute<T> {
@override
Color? get barrierColor => null;
CurvedAnimation? _curvedAnimation;
void _setAnimation(Animation<double> animation) {
if (_curvedAnimation?.parent != animation) {
_curvedAnimation?.dispose();
_curvedAnimation = CurvedAnimation(
parent: animation,
curve: Curves.easeOut,
);
}
}
@override
Widget buildTransitions(
BuildContext context,
@@ -38,12 +50,19 @@ class HeroDialogRoute<T> extends PageRoute<T> {
Animation<double> secondaryAnimation,
Widget child,
) {
_setAnimation(animation);
return FadeTransition(
opacity: CurvedAnimation(parent: animation, curve: Curves.easeOut),
opacity: _curvedAnimation!,
child: child,
);
}
@override
void dispose() {
_curvedAnimation?.dispose();
super.dispose();
}
@override
Widget buildPage(
BuildContext context,

View File

@@ -503,7 +503,9 @@ class _InteractiveViewerState extends State<InteractiveViewer>
final GlobalKey _childKey = GlobalKey();
final GlobalKey _parentKey = GlobalKey();
Animation<Offset>? _animation;
CurvedAnimation? _curvedAnimation;
Animation<double>? _scaleAnimation;
CurvedAnimation? _curvedScaleAnimation;
late Offset _scaleAnimationFocalPoint;
late AnimationController _controller;
late AnimationController _scaleController;
@@ -930,7 +932,10 @@ class _InteractiveViewerState extends State<InteractiveViewer>
frictionSimulationY.finalX,
),
).animate(
CurvedAnimation(parent: _controller, curve: Curves.decelerate),
_curvedAnimation ??= CurvedAnimation(
parent: _controller,
curve: Curves.decelerate,
),
);
_controller.duration = Duration(milliseconds: (tFinal * 1000).round());
_animation!.addListener(_handleInertiaAnimation);
@@ -956,7 +961,7 @@ class _InteractiveViewerState extends State<InteractiveViewer>
begin: scale,
end: frictionSimulation.x(tFinal),
).animate(
CurvedAnimation(
_curvedScaleAnimation ??= CurvedAnimation(
parent: _scaleController,
curve: Curves.decelerate,
),
@@ -1150,7 +1155,9 @@ class _InteractiveViewerState extends State<InteractiveViewer>
@override
void dispose() {
_curvedAnimation?.dispose();
_controller.dispose();
_curvedScaleAnimation?.dispose();
_scaleController.dispose();
_transformer.removeListener(_handleTransformation);
if (widget.transformationController == null) {