mod: listener

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-02-25 12:38:20 +08:00
parent 0e69e23606
commit e236485bc7
29 changed files with 348 additions and 334 deletions

View File

@@ -82,20 +82,22 @@ class ActionItemState extends State<ActionItem> with TickerProviderStateMixin {
);
_animation = Tween<double>(begin: 0, end: -2 * pi).animate(controller!)
..addListener(() {
setState(() {
_hideCircle = _animation?.value == -2 * pi;
if (_hideCircle) {
controller?.reset();
if (_isThumbUp) {
widget.onLongPress?.call();
}
}
});
});
..addListener(listener);
}
}
void listener() {
setState(() {
_hideCircle = _animation?.value == -2 * pi;
if (_hideCircle) {
controller?.reset();
if (_isThumbUp) {
widget.onLongPress?.call();
}
}
});
}
void cancelTimer() {
_timer?.cancel();
_timer = null;
@@ -104,7 +106,7 @@ class ActionItemState extends State<ActionItem> with TickerProviderStateMixin {
@override
void dispose() {
cancelTimer();
_animation?.removeListener(() {});
_animation?.removeListener(listener);
controller?.dispose();
super.dispose();
}