feat: 全屏手势可关闭

This commit is contained in:
guozhigq
2024-10-13 16:41:53 +08:00
parent c1cd024db6
commit 3a2d9def65
3 changed files with 19 additions and 6 deletions

View File

@ -204,6 +204,14 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
widget.controller.brightness.value = value;
}
bool isUsingFullScreenGestures(double tapPosition, double sectionWidth) {
if (fullScreenGestureMode == FullScreenGestureMode.none) {
return false;
} else {
return tapPosition < sectionWidth * 2;
}
}
@override
void dispose() {
animationController.dispose();
@ -660,12 +668,12 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
_brightnessValue.value - delta / level;
final double result = brightness.clamp(0.0, 1.0);
setBrightness(result);
} else if (tapPosition < sectionWidth * 2) {
} else if (isUsingFullScreenGestures(tapPosition, sectionWidth)) {
// 全屏
final double dy = details.delta.dy;
const double threshold = 7.0; // 滑动阈值
final bool flag =
fullScreenGestureMode != FullScreenGestureMode.values.last;
final bool flag = fullScreenGestureMode !=
FullScreenGestureMode.fromBottomtoTop;
if (dy > _distance.value &&
dy > threshold &&
!_.controlsLock.value) {