opt triple mixin

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-08-09 19:25:21 +08:00
parent 30aa29598b
commit 11c6745fd7
4 changed files with 6 additions and 18 deletions

View File

@@ -64,13 +64,6 @@ class _PgcIntroPageState extends State<PgcIntroPage>
super.initState(); super.initState();
pgcIntroController = Get.put(PgcIntroController(), tag: widget.heroTag); pgcIntroController = Get.put(PgcIntroController(), tag: widget.heroTag);
videoDetailCtr = Get.find<VideoDetailController>(tag: widget.heroTag); videoDetailCtr = Get.find<VideoDetailController>(tag: widget.heroTag);
initTriple();
}
@override
void dispose() {
disposeTriple();
super.dispose();
} }
@override @override

View File

@@ -67,13 +67,6 @@ class _UgcIntroPanelState extends State<UgcIntroPanel>
void initState() { void initState() {
super.initState(); super.initState();
ugcIntroController = Get.put(UgcIntroController(), tag: widget.heroTag); ugcIntroController = Get.put(UgcIntroController(), tag: widget.heroTag);
initTriple();
}
@override
void dispose() {
disposeTriple();
super.dispose();
} }
@override @override

View File

@@ -18,7 +18,9 @@ mixin TripleAnimMixin<T extends StatefulWidget>
void onTriple(); void onTriple();
void onLike(); void onLike();
void initTriple() { @override
void initState() {
super.initState();
animController = AnimationController( animController = AnimationController(
vsync: this, vsync: this,
duration: const Duration(milliseconds: 1500), duration: const Duration(milliseconds: 1500),
@@ -69,9 +71,11 @@ mixin TripleAnimMixin<T extends StatefulWidget>
_timer = null; _timer = null;
} }
void disposeTriple() { @override
void dispose() {
cancelTimer(); cancelTimer();
animController.dispose(); animController.dispose();
super.dispose();
} }
} }

View File

@@ -89,13 +89,11 @@ class HeaderControlState extends State<HeaderControl>
} else { } else {
pgcIntroController = Get.find<PgcIntroController>(tag: heroTag); pgcIntroController = Get.find<PgcIntroController>(tag: heroTag);
} }
initTriple();
} }
@override @override
void dispose() { void dispose() {
clock?.cancel(); clock?.cancel();
disposeTriple();
super.dispose(); super.dispose();
} }