Skip to content

基于自定义规则的番剧采集APP,支持流媒体在线观看,支持弹幕,支持实时超分辨率。

simplify code

lauirfa9e703ca3641
diff --git a/lib/pages/player/player_item.dart b/lib/pages/player/player_item.dart
index 15d60c0f..058b61db 100644
--- a/lib/pages/player/player_item.dart
+++ b/lib/pages/player/player_item.dart
@@ -131,15 +131,7 @@ class _PlayerItemState extends State<PlayerItem>
if (!showPositioned) {
_animationController.forward();
hideTimer?.cancel();
- hideTimer = Timer(const Duration(seconds: 4), () {
- if (mounted) {
- setState(() {
- showPositioned = false;
- });
- _animationController.reverse();
- }
- hideTimer = null;
- });
+ startHideTimer();
} else {
_animationController.reverse();
hideTimer?.cancel();
@@ -157,16 +149,7 @@ class _PlayerItemState extends State<PlayerItem>
showPositioned = true;
});
hideTimer?.cancel();
-
- hideTimer = Timer(const Duration(seconds: 4), () {
- if (mounted) {
- setState(() {
- showPositioned = false;
- });
- _animationController.reverse();
- }
- hideTimer = null;
- });
+ startHideTimer();
}
void _handleMouseScroller() {
@@ -1623,7 +1606,6 @@ class _PlayerItemState extends State<PlayerItem>
total: playerController.duration,
onSeek: (duration) {
playerTimer?.cancel();
-
playerController.currentPosition = duration;
playerController.seek(duration);
playerTimer = getPlayerTimer(); //Bug_time
@@ -1635,16 +1617,7 @@ class _PlayerItemState extends State<PlayerItem>
})},
onDragEnd: () {
playerController.play();
- hideTimer =
- Timer(const Duration(seconds: 4), () {
- if (mounted) {
- setState(() {
- showPositioned = false;
- });
- _animationController.reverse();
- }
- hideTimer = null;
- });
+ startHideTimer();
},
),
),
@@ -1772,4 +1745,16 @@ class _PlayerItemState extends State<PlayerItem>
);
});
}
+
+ void startHideTimer() {
+ hideTimer = Timer(const Duration(seconds: 4), () {
+ if (mounted) {
+ setState(() {
+ showPositioned = false;
+ });
+ _animationController.reverse();
+ }
+ hideTimer = null;
+ });
+ }
}