Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
dom
2026-01-20 17:42:40 +08:00
parent 923af32c96
commit 0b1f6c4d0e
26 changed files with 377 additions and 451 deletions

View File

@@ -941,10 +941,12 @@ class VideoDetailController extends GetxController
return Align(
alignment: Alignment.centerLeft,
child: SlideTransition(
position: Tween<Offset>(
begin: const Offset(-1, 0),
end: Offset.zero,
).animate(animation),
position: animation.drive(
Tween<Offset>(
begin: const Offset(-1.0, 0.0),
end: Offset.zero,
),
),
child: Padding(
padding: const EdgeInsets.only(top: 5),
child: GestureDetector(

View File

@@ -56,7 +56,7 @@ class ActionItem extends StatelessWidget {
builder: (context, child) => Arc(
size: 28,
color: primary,
sweepAngle: animation!.value,
progress: -animation!.value,
),
),
child,

View File

@@ -1,5 +1,4 @@
import 'dart:async';
import 'dart:math' show pi;
import 'package:PiliPlus/utils/platform_utils.dart';
import 'package:flutter/material.dart';
@@ -24,7 +23,6 @@ mixin TripleMixin on GetxController, TickerProvider {
// no need for pugv
AnimationController? _tripleAnimCtr;
CurvedAnimation? _curvedAnimation;
Animation<double>? _tripleAnimation;
AnimationController get tripleAnimCtr =>
@@ -34,15 +32,8 @@ mixin TripleMixin on GetxController, TickerProvider {
reverseDuration: const Duration(milliseconds: 400),
);
CurvedAnimation get curvedAnimation => _curvedAnimation ??= CurvedAnimation(
parent: tripleAnimCtr,
curve: Curves.easeInOut,
);
Animation<double> get tripleAnimation => _tripleAnimation ??= Tween<double>(
begin: 0,
end: -2 * pi,
).animate(curvedAnimation);
Animation<double> get tripleAnimation => _tripleAnimation ??= tripleAnimCtr
.drive(CurveTween(curve: Curves.easeInOut));
Timer? _timer;
@@ -84,7 +75,6 @@ mixin TripleMixin on GetxController, TickerProvider {
@override
void onClose() {
_cancelTimer();
_curvedAnimation?.dispose();
_tripleAnimCtr?.dispose();
super.onClose();
}

View File

@@ -46,12 +46,7 @@ class PayCoinsPage extends StatefulWidget {
transitionDuration: const Duration(milliseconds: 225),
transitionBuilder: (context, animation, secondaryAnimation, child) {
return FadeTransition(
opacity: animation.drive(
Tween<double>(
begin: 0.0,
end: 1.0,
).chain(CurveTween(curve: Curves.linear)),
),
opacity: animation,
child: child,
);
},
@@ -73,9 +68,8 @@ class _PayCoinsPageState extends State<PayCoinsPage>
late final Animation<Offset> _slide22Anim;
late final AnimationController _scale22Controller;
late final Animation<double> _scale22Anim;
late final AnimationController _coinSlideController;
late final AnimationController _coinController;
late final Animation<Offset> _coinSlideAnim;
late final AnimationController _coinFadeController;
late final Animation<double> _coinFadeAnim;
late final AnimationController _boxAnimController;
late final Animation<Offset> _boxAnim;
@@ -155,7 +149,7 @@ class _PayCoinsPageState extends State<PayCoinsPage>
duration: const Duration(milliseconds: 50),
);
_slide22Anim = _slide22Controller.drive(
Tween(
Tween<Offset>(
begin: Offset.zero,
end: const Offset(0.0, -0.2),
),
@@ -165,32 +159,30 @@ class _PayCoinsPageState extends State<PayCoinsPage>
duration: const Duration(milliseconds: 50),
);
_scale22Anim = _scale22Controller.drive(
Tween(begin: 1, end: 1.1),
Tween<double>(begin: 1.0, end: 1.1),
);
_coinSlideController = AnimationController(
_coinController = AnimationController(
vsync: this,
duration: const Duration(milliseconds: 200),
duration: const Duration(milliseconds: 300),
);
_coinSlideAnim = _coinSlideController.drive(
Tween(
_coinSlideAnim = _coinController.drive(
Tween<Offset>(
begin: Offset.zero,
end: const Offset(0.0, -2),
),
end: const Offset(0.0, -2.0),
).chain(CurveTween(curve: const Interval(0.0, 2 / 3))),
);
_coinFadeController = AnimationController(
vsync: this,
duration: const Duration(milliseconds: 100),
_coinFadeAnim = _coinController.drive(
Tween<double>(
begin: 1.0,
end: 0.0,
).chain(CurveTween(curve: const Interval(2 / 3, 1.0))),
);
_coinFadeAnim = Tween<double>(
begin: 1,
end: 0,
).animate(_coinFadeController);
_boxAnimController = AnimationController(
vsync: this,
duration: const Duration(milliseconds: 50),
);
_boxAnim = _boxAnimController.drive(
Tween(
Tween<Offset>(
begin: Offset.zero,
end: const Offset(0.0, -0.2),
),
@@ -204,8 +196,7 @@ class _PayCoinsPageState extends State<PayCoinsPage>
_cancelTimer();
_slide22Controller.dispose();
_scale22Controller.dispose();
_coinSlideController.dispose();
_coinFadeController.dispose();
_coinController.dispose();
_boxAnimController.dispose();
_controller?.dispose();
super.dispose();
@@ -570,11 +561,9 @@ class _PayCoinsPageState extends State<PayCoinsPage>
});
}
_boxAnimController.forward().whenComplete(_boxAnimController.reverse);
_coinSlideController.forward().whenComplete(() {
_coinFadeController.forward().whenComplete(() {
Get.back();
widget.onPayCoin(_pageIndex.value + 1, _coinWithLike.value);
});
_coinController.forward().whenComplete(() {
Get.back();
widget.onPayCoin(_pageIndex.value + 1, _coinWithLike.value);
});
});
});

View File

@@ -28,7 +28,6 @@ class VideoReplyController extends ReplyController<MainListReply>
bool _isFabVisible = true;
late final AnimationController _fabAnimationCtr;
late final CurvedAnimation _curvedAnimation;
late final Animation<Offset> animation;
@override
@@ -38,14 +37,12 @@ class VideoReplyController extends ReplyController<MainListReply>
vsync: this,
duration: const Duration(milliseconds: 100),
)..forward();
_curvedAnimation = CurvedAnimation(
parent: _fabAnimationCtr,
curve: Curves.easeInOut,
animation = _fabAnimationCtr.drive(
Tween<Offset>(
begin: const Offset(0.0, 2.0),
end: Offset.zero,
).chain(CurveTween(curve: Curves.easeInOut)),
);
animation = Tween<Offset>(
begin: const Offset(0, 2),
end: Offset.zero,
).animate(_curvedAnimation);
}
void showFab() {
@@ -78,7 +75,6 @@ class VideoReplyController extends ReplyController<MainListReply>
@override
void onClose() {
_curvedAnimation.dispose();
_fabAnimationCtr.dispose();
super.onClose();
}

View File

@@ -94,7 +94,6 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel>
with SingleTickerProviderStateMixin, CommonSlideMixin {
late VideoReplyReplyController _controller;
late final _tag = Utils.makeHeroTag('${widget.rpid}${widget.dialog}');
CurvedAnimation? _curvedAnimation;
Animation<Color?>? _colorAnimation;
late final bool isDialogue = widget.dialog != null;
@@ -129,7 +128,6 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel>
@override
void dispose() {
_curvedAnimation?.dispose();
Get.delete<VideoReplyReplyController>(tag: _tag);
super.dispose();
}
@@ -334,16 +332,16 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel>
final child = _replyItem(context, response[index], index);
if (jumpIndex == index) {
return AnimatedBuilder(
animation: _colorAnimation ??=
ColorTween(
begin: theme.colorScheme.onInverseSurface,
end: theme.colorScheme.surface,
).animate(
_curvedAnimation ??= CurvedAnimation(
parent: _controller.animController,
curve: const Interval(0.8, 1.0), // 前0.8s不变, 后0.2s开始动画
),
animation: _colorAnimation ??= _controller.animController.drive(
ColorTween(
begin: theme.colorScheme.onInverseSurface,
end: theme.colorScheme.surface,
).chain(
CurveTween(
curve: const Interval(0.8, 1.0), // 前0.8s不变, 后0.2s开始动画
),
),
),
child: child,
builder: (context, child) {
return ColoredBox(