opt: video progressbar

Closes #507
Closes #514

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-03-24 21:29:28 +08:00
parent a611a88f69
commit bf464994df
2 changed files with 46 additions and 42 deletions

View File

@@ -450,7 +450,9 @@ class _PostPanelState extends CommonCollapseSlidePageState<PostPanel> {
updateSegment( updateSegment(
isFirst: isFirst, isFirst: isFirst,
index: index, index: index,
value: isFirst ? 0 : plPlayerController.duration.value.inSeconds, value: isFirst
? 0
: plPlayerController.durationSeconds.value.inSeconds,
); );
}); });
}, },

View File

@@ -1393,7 +1393,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
return const SizedBox.shrink(); return const SizedBox.shrink();
} }
return Positioned( return Positioned(
bottom: -1, bottom: -2.2,
left: 0, left: 0,
right: 0, right: 0,
child: Semantics( child: Semantics(
@@ -1410,46 +1410,48 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
if (plPlayerController.viewPointList.isNotEmpty && if (plPlayerController.viewPointList.isNotEmpty &&
plPlayerController.showVP.value) plPlayerController.showVP.value)
buildViewPointWidget(plPlayerController, 4.25), buildViewPointWidget(plPlayerController, 4.25),
ProgressBar( IgnorePointer(
progress: Duration(seconds: value), child: ProgressBar(
buffered: Duration(seconds: buffer), progress: Duration(seconds: value),
total: Duration(seconds: max), buffered: Duration(seconds: buffer),
progressBarColor: colorTheme, total: Duration(seconds: max),
baseBarColor: Colors.white.withOpacity(0.2), progressBarColor: colorTheme,
bufferedBarColor: Theme.of(context) baseBarColor: Colors.white.withOpacity(0.2),
.colorScheme bufferedBarColor: Theme.of(context)
.primary .colorScheme
.withOpacity(0.4), .primary
timeLabelLocation: TimeLabelLocation.none, .withOpacity(0.4),
thumbColor: colorTheme, timeLabelLocation: TimeLabelLocation.none,
barHeight: 3.5, thumbColor: colorTheme,
thumbRadius: draggingFixedProgressBar.value ? 7 : 2.5, barHeight: 3.5,
// onDragStart: (duration) { thumbRadius: draggingFixedProgressBar.value ? 7 : 2.5,
// feedBack(); // onDragStart: (duration) {
// plPlayerController.onChangedSliderStart(); // feedBack();
// }, // plPlayerController.onChangedSliderStart();
// onDragUpdate: (duration) { // },
// plPlayerController // onDragUpdate: (duration) {
// .onUpdatedSliderProgress(duration.timeStamp); // plPlayerController
// if (plPlayerController.showSeekPreview) { // .onUpdatedSliderProgress(duration.timeStamp);
// if (plPlayerController.showPreview.value.not) { // if (plPlayerController.showSeekPreview) {
// plPlayerController.showPreview.value = true; // if (plPlayerController.showPreview.value.not) {
// } // plPlayerController.showPreview.value = true;
// plPlayerController.previewDx.value = // }
// duration.localPosition.dx; // plPlayerController.previewDx.value =
// } // duration.localPosition.dx;
// }, // }
// onSeek: (duration) { // },
// if (plPlayerController.showSeekPreview) { // onSeek: (duration) {
// plPlayerController.showPreview.value = false; // if (plPlayerController.showSeekPreview) {
// } // plPlayerController.showPreview.value = false;
// plPlayerController.onChangedSliderEnd(); // }
// plPlayerController // plPlayerController.onChangedSliderEnd();
// .onChangedSlider(duration.inSeconds.toDouble()); // plPlayerController
// plPlayerController.seekTo( // .onChangedSlider(duration.inSeconds.toDouble());
// Duration(seconds: duration.inSeconds), // plPlayerController.seekTo(
// type: 'slider'); // Duration(seconds: duration.inSeconds),
// }, // type: 'slider');
// },
),
), ),
if (plPlayerController.segmentList.isNotEmpty) if (plPlayerController.segmentList.isNotEmpty)
Positioned( Positioned(