From bf464994dfd0fa2dd36a12dcdf2a63419c97f00a Mon Sep 17 00:00:00 2001 From: bggRGjQaUbCoE Date: Mon, 24 Mar 2025 21:29:28 +0800 Subject: [PATCH] opt: video progressbar Closes #507 Closes #514 Signed-off-by: bggRGjQaUbCoE --- .../video/detail/post_panel/post_panel.dart | 4 +- lib/plugin/pl_player/view.dart | 84 ++++++++++--------- 2 files changed, 46 insertions(+), 42 deletions(-) diff --git a/lib/pages/video/detail/post_panel/post_panel.dart b/lib/pages/video/detail/post_panel/post_panel.dart index c6e56a60..8b7c4306 100644 --- a/lib/pages/video/detail/post_panel/post_panel.dart +++ b/lib/pages/video/detail/post_panel/post_panel.dart @@ -450,7 +450,9 @@ class _PostPanelState extends CommonCollapseSlidePageState { updateSegment( isFirst: isFirst, index: index, - value: isFirst ? 0 : plPlayerController.duration.value.inSeconds, + value: isFirst + ? 0 + : plPlayerController.durationSeconds.value.inSeconds, ); }); }, diff --git a/lib/plugin/pl_player/view.dart b/lib/plugin/pl_player/view.dart index d4dca74b..ea070a5b 100644 --- a/lib/plugin/pl_player/view.dart +++ b/lib/plugin/pl_player/view.dart @@ -1393,7 +1393,7 @@ class _PLVideoPlayerState extends State return const SizedBox.shrink(); } return Positioned( - bottom: -1, + bottom: -2.2, left: 0, right: 0, child: Semantics( @@ -1410,46 +1410,48 @@ class _PLVideoPlayerState extends State if (plPlayerController.viewPointList.isNotEmpty && plPlayerController.showVP.value) buildViewPointWidget(plPlayerController, 4.25), - ProgressBar( - progress: Duration(seconds: value), - buffered: Duration(seconds: buffer), - total: Duration(seconds: max), - progressBarColor: colorTheme, - baseBarColor: Colors.white.withOpacity(0.2), - bufferedBarColor: Theme.of(context) - .colorScheme - .primary - .withOpacity(0.4), - timeLabelLocation: TimeLabelLocation.none, - thumbColor: colorTheme, - barHeight: 3.5, - thumbRadius: draggingFixedProgressBar.value ? 7 : 2.5, - // onDragStart: (duration) { - // feedBack(); - // plPlayerController.onChangedSliderStart(); - // }, - // onDragUpdate: (duration) { - // plPlayerController - // .onUpdatedSliderProgress(duration.timeStamp); - // if (plPlayerController.showSeekPreview) { - // if (plPlayerController.showPreview.value.not) { - // plPlayerController.showPreview.value = true; - // } - // plPlayerController.previewDx.value = - // duration.localPosition.dx; - // } - // }, - // onSeek: (duration) { - // if (plPlayerController.showSeekPreview) { - // plPlayerController.showPreview.value = false; - // } - // plPlayerController.onChangedSliderEnd(); - // plPlayerController - // .onChangedSlider(duration.inSeconds.toDouble()); - // plPlayerController.seekTo( - // Duration(seconds: duration.inSeconds), - // type: 'slider'); - // }, + IgnorePointer( + child: ProgressBar( + progress: Duration(seconds: value), + buffered: Duration(seconds: buffer), + total: Duration(seconds: max), + progressBarColor: colorTheme, + baseBarColor: Colors.white.withOpacity(0.2), + bufferedBarColor: Theme.of(context) + .colorScheme + .primary + .withOpacity(0.4), + timeLabelLocation: TimeLabelLocation.none, + thumbColor: colorTheme, + barHeight: 3.5, + thumbRadius: draggingFixedProgressBar.value ? 7 : 2.5, + // onDragStart: (duration) { + // feedBack(); + // plPlayerController.onChangedSliderStart(); + // }, + // onDragUpdate: (duration) { + // plPlayerController + // .onUpdatedSliderProgress(duration.timeStamp); + // if (plPlayerController.showSeekPreview) { + // if (plPlayerController.showPreview.value.not) { + // plPlayerController.showPreview.value = true; + // } + // plPlayerController.previewDx.value = + // duration.localPosition.dx; + // } + // }, + // onSeek: (duration) { + // if (plPlayerController.showSeekPreview) { + // plPlayerController.showPreview.value = false; + // } + // plPlayerController.onChangedSliderEnd(); + // plPlayerController + // .onChangedSlider(duration.inSeconds.toDouble()); + // plPlayerController.seekTo( + // Duration(seconds: duration.inSeconds), + // type: 'slider'); + // }, + ), ), if (plPlayerController.segmentList.isNotEmpty) Positioned(