fix: show Controls progress bar during drag instead of full overlay

This commit is contained in:
систем
2026-04-10 21:51:03 +08:00
parent e40a72f8c9
commit 18ecda3379
3 changed files with 15 additions and 16 deletions

View File

@@ -145,7 +145,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
late FullScreenMode mode;
late final RxBool showRestoreScaleBtn = false.obs;
final RxBool _isDraggingProgress = false.obs;
GestureType? _gestureType;
@@ -977,7 +977,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
final dy = cumulativeDelta.dy.abs();
if (dx > 3 * dy) {
_gestureType = GestureType.horizontal;
_isDraggingProgress.value = true;
plPlayerController.isDraggingProgress.value = true;
} else if (dy > 3 * dx) {
if (!plPlayerController.enableSlideVolumeBrightness &&
!plPlayerController.enableSlideFS) {
@@ -1128,7 +1128,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
}
void _onInteractionEnd(ScaleEndDetails details) {
_isDraggingProgress.value = false;
plPlayerController.isDraggingProgress.value = false;
if (plPlayerController.showSeekPreview) {
plPlayerController.showPreview.value = false;
}
@@ -1286,7 +1286,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
final dy = pan.dy.abs();
if (dx > 3 * dy) {
_gestureType = GestureType.horizontal;
_isDraggingProgress.value = true;
plPlayerController.isDraggingProgress.value = true;
} else if (dy > 3 * dx) {
_gestureType = GestureType.right;
}
@@ -1340,7 +1340,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
}
void _onPointerPanZoomEnd(PointerPanZoomEndEvent event) {
_isDraggingProgress.value = false;
plPlayerController.isDraggingProgress.value = false;
_gestureType = null;
}
@@ -1728,16 +1728,13 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
child: Obx(
() {
final showControls = plPlayerController.showControls.value;
final isDragging = _isDraggingProgress.value;
final offstage = isDragging
? false
: switch (plPlayerController.progressType) {
BtmProgressBehavior.onlyShowFullScreen =>
showControls || !isFullScreen,
BtmProgressBehavior.onlyHideFullScreen =>
showControls || isFullScreen,
_ => showControls,
};
final offstage = switch (plPlayerController.progressType) {
BtmProgressBehavior.onlyShowFullScreen =>
showControls || !isFullScreen,
BtmProgressBehavior.onlyHideFullScreen =>
showControls || isFullScreen,
_ => showControls,
};
return Offstage(
offstage: offstage,
child: Stack(