mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-20 03:06:59 +08:00
opt player progress bar behavior (#1887)
* feat: no _showControlsIfNeeded() when slipping * Revert "feat: no _showControlsIfNeeded() when slipping" This reverts commit551be3dc6a. * feat: show progress bar during drag without revealing controls overlay * fix: show Controls progress bar during drag instead of full overlay * Revert "fix: show Controls progress bar during drag instead of full overlay" This reverts commit18ecda3379. * fix: hide thin progress bar during drag when Controls already visible * fix: show thin progress bar during drag when progressType is alwaysHide * Revert "fix: show thin progress bar during drag when progressType is alwaysHide" This reverts commit1a60c8e6df. * fix: show thin progress bar during drag when progressType is alwaysHide * update --------- Co-authored-by: dom <githubaccount56556@proton.me>
This commit is contained in:
@@ -38,7 +38,6 @@ import 'package:PiliPlus/pages/video/post_panel/view.dart';
|
||||
import 'package:PiliPlus/pages/video/widgets/header_control.dart';
|
||||
import 'package:PiliPlus/plugin/pl_player/controller.dart';
|
||||
import 'package:PiliPlus/plugin/pl_player/models/bottom_control_type.dart';
|
||||
import 'package:PiliPlus/plugin/pl_player/models/bottom_progress_behavior.dart';
|
||||
import 'package:PiliPlus/plugin/pl_player/models/data_status.dart';
|
||||
import 'package:PiliPlus/plugin/pl_player/models/double_tap_type.dart';
|
||||
import 'package:PiliPlus/plugin/pl_player/models/fullscreen_mode.dart';
|
||||
@@ -976,7 +975,6 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
final dy = cumulativeDelta.dy.abs();
|
||||
if (dx > 3 * dy) {
|
||||
_gestureType = GestureType.horizontal;
|
||||
_showControlsIfNeeded();
|
||||
} else if (dy > 3 * dx) {
|
||||
if (!plPlayerController.enableSlideVolumeBrightness &&
|
||||
!plPlayerController.enableSlideFS) {
|
||||
@@ -1274,19 +1272,6 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
}
|
||||
}
|
||||
|
||||
void _showControlsIfNeeded() {
|
||||
if (plPlayerController.isLive) return;
|
||||
late final isFullScreen = this.isFullScreen;
|
||||
final progressType = plPlayerController.progressType;
|
||||
if (progressType == BtmProgressBehavior.alwaysHide ||
|
||||
(isFullScreen &&
|
||||
progressType == BtmProgressBehavior.onlyHideFullScreen) ||
|
||||
(!isFullScreen &&
|
||||
progressType == BtmProgressBehavior.onlyShowFullScreen)) {
|
||||
plPlayerController.controls = true;
|
||||
}
|
||||
}
|
||||
|
||||
void _onPointerPanZoomUpdate(PointerPanZoomUpdateEvent event) {
|
||||
if (plPlayerController.controlsLock.value) return;
|
||||
if (_gestureType == null) {
|
||||
@@ -1296,7 +1281,6 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
final dy = pan.dy.abs();
|
||||
if (dx > 3 * dy) {
|
||||
_gestureType = GestureType.horizontal;
|
||||
_showControlsIfNeeded();
|
||||
} else if (dy > 3 * dx) {
|
||||
_gestureType = GestureType.right;
|
||||
}
|
||||
@@ -1728,8 +1712,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
),
|
||||
|
||||
/// 进度条 live模式下禁用
|
||||
if (!isLive &&
|
||||
plPlayerController.progressType != BtmProgressBehavior.alwaysHide)
|
||||
if (!isLive)
|
||||
Positioned(
|
||||
bottom: -2.2,
|
||||
left: 0,
|
||||
@@ -1737,13 +1720,26 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
child: Obx(
|
||||
() {
|
||||
final showControls = plPlayerController.showControls.value;
|
||||
final offstage = switch (plPlayerController.progressType) {
|
||||
BtmProgressBehavior.onlyShowFullScreen =>
|
||||
showControls || !isFullScreen,
|
||||
BtmProgressBehavior.onlyHideFullScreen =>
|
||||
showControls || isFullScreen,
|
||||
_ => showControls,
|
||||
};
|
||||
final bool offstage;
|
||||
switch (plPlayerController.progressType) {
|
||||
case .alwaysShow:
|
||||
offstage = showControls;
|
||||
case .alwaysHide:
|
||||
if (!plPlayerController.isSliderMoving.value) {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
offstage = showControls;
|
||||
case .onlyShowFullScreen:
|
||||
offstage =
|
||||
showControls ||
|
||||
(!isFullScreen &&
|
||||
!plPlayerController.isSliderMoving.value);
|
||||
case .onlyHideFullScreen:
|
||||
offstage =
|
||||
showControls ||
|
||||
(isFullScreen &&
|
||||
!plPlayerController.isSliderMoving.value);
|
||||
}
|
||||
return Offstage(
|
||||
offstage: offstage,
|
||||
child: Stack(
|
||||
|
||||
Reference in New Issue
Block a user