mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-21 11:22:16 +08:00
@@ -31,18 +31,6 @@ 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,
|
||||
@@ -50,19 +38,12 @@ class HeroDialogRoute<T> extends PageRoute<T> {
|
||||
Animation<double> secondaryAnimation,
|
||||
Widget child,
|
||||
) {
|
||||
_setAnimation(animation);
|
||||
return FadeTransition(
|
||||
opacity: _curvedAnimation!,
|
||||
opacity: animation.drive(CurveTween(curve: Curves.easeOut)),
|
||||
child: child,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_curvedAnimation?.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget buildPage(
|
||||
BuildContext context,
|
||||
|
||||
@@ -503,9 +503,7 @@ 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;
|
||||
@@ -924,19 +922,15 @@ class _InteractiveViewerState extends State<InteractiveViewer>
|
||||
details.velocity.pixelsPerSecond.distance,
|
||||
widget.interactionEndFrictionCoefficient,
|
||||
);
|
||||
_animation =
|
||||
Tween<Offset>(
|
||||
begin: translation,
|
||||
end: Offset(
|
||||
frictionSimulationX.finalX,
|
||||
frictionSimulationY.finalX,
|
||||
),
|
||||
).animate(
|
||||
_curvedAnimation ??= CurvedAnimation(
|
||||
parent: _controller,
|
||||
curve: Curves.decelerate,
|
||||
),
|
||||
);
|
||||
_animation = _controller.drive(
|
||||
Tween<Offset>(
|
||||
begin: translation,
|
||||
end: Offset(
|
||||
frictionSimulationX.finalX,
|
||||
frictionSimulationY.finalX,
|
||||
),
|
||||
).chain(CurveTween(curve: Curves.decelerate)),
|
||||
);
|
||||
_controller.duration = Duration(milliseconds: (tFinal * 1000).round());
|
||||
_animation!.addListener(_handleInertiaAnimation);
|
||||
_controller.forward();
|
||||
@@ -956,16 +950,12 @@ class _InteractiveViewerState extends State<InteractiveViewer>
|
||||
widget.interactionEndFrictionCoefficient,
|
||||
effectivelyMotionless: 0.1,
|
||||
);
|
||||
_scaleAnimation =
|
||||
Tween<double>(
|
||||
begin: scale,
|
||||
end: frictionSimulation.x(tFinal),
|
||||
).animate(
|
||||
_curvedScaleAnimation ??= CurvedAnimation(
|
||||
parent: _scaleController,
|
||||
curve: Curves.decelerate,
|
||||
),
|
||||
);
|
||||
_scaleAnimation = _scaleController.drive(
|
||||
Tween<double>(
|
||||
begin: scale,
|
||||
end: frictionSimulation.x(tFinal),
|
||||
).chain(CurveTween(curve: Curves.decelerate)),
|
||||
);
|
||||
_scaleController.duration = Duration(
|
||||
milliseconds: (tFinal * 1000).round(),
|
||||
);
|
||||
@@ -1155,9 +1145,7 @@ class _InteractiveViewerState extends State<InteractiveViewer>
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_curvedAnimation?.dispose();
|
||||
_controller.dispose();
|
||||
_curvedScaleAnimation?.dispose();
|
||||
_scaleController.dispose();
|
||||
_transformer.removeListener(_handleTransformation);
|
||||
if (widget.transformationController == null) {
|
||||
|
||||
@@ -114,7 +114,7 @@ class InteractiveViewerBoundaryState extends State<InteractiveViewerBoundary>
|
||||
|
||||
_scaleAnimation = _animateController.drive(
|
||||
Tween<double>(
|
||||
begin: 1,
|
||||
begin: 1.0,
|
||||
end: 0.25,
|
||||
),
|
||||
);
|
||||
|
||||
@@ -207,13 +207,12 @@ class _InteractiveviewerGalleryState extends State<InteractiveviewerGallery>
|
||||
if (_transformationController.value != Matrix4.identity()) {
|
||||
// animate the reset for the transformation of the interactive viewer
|
||||
|
||||
_animation =
|
||||
Matrix4Tween(
|
||||
begin: _transformationController.value,
|
||||
end: Matrix4.identity(),
|
||||
).animate(
|
||||
CurveTween(curve: Curves.easeOut).animate(_animationController),
|
||||
);
|
||||
_animation = _animationController.drive(
|
||||
Matrix4Tween(
|
||||
begin: _transformationController.value,
|
||||
end: Matrix4.identity(),
|
||||
).chain(CurveTween(curve: Curves.easeOut)),
|
||||
);
|
||||
|
||||
_animationController.forward(from: 0);
|
||||
}
|
||||
@@ -401,13 +400,12 @@ class _InteractiveviewerGalleryState extends State<InteractiveviewerGallery>
|
||||
matrix.row3.w,
|
||||
]);
|
||||
|
||||
_animation =
|
||||
Matrix4Tween(
|
||||
begin: _transformationController.value,
|
||||
end: matrix,
|
||||
).animate(
|
||||
CurveTween(curve: Curves.easeOut).animate(_animationController),
|
||||
);
|
||||
_animation = _animationController.drive(
|
||||
Matrix4Tween(
|
||||
begin: _transformationController.value,
|
||||
end: matrix,
|
||||
).chain(CurveTween(curve: Curves.easeOut)),
|
||||
);
|
||||
_animationController
|
||||
.forward(from: 0)
|
||||
.whenComplete(() => _onScaleChanged(targetScale));
|
||||
|
||||
Reference in New Issue
Block a user