mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-06-01 00:28:18 +08:00
feat: 回退全屏手势时机,提早触发;微调阈值
This commit is contained in:
@@ -601,14 +601,27 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
|||||||
setBrightness(result);
|
setBrightness(result);
|
||||||
} else if (_gestureType == 'center') {
|
} else if (_gestureType == 'center') {
|
||||||
// 全屏
|
// 全屏
|
||||||
const double threshold = 2; // 滑动阈值
|
const double threshold = 2.5; // 滑动阈值
|
||||||
double cumulativeDy =
|
double cumulativeDy =
|
||||||
details.localFocalPoint.dy - _initialFocalPoint.dy;
|
details.localFocalPoint.dy - _initialFocalPoint.dy;
|
||||||
|
|
||||||
|
void fullScreenTrigger(bool status) {
|
||||||
|
EasyThrottle.throttle(
|
||||||
|
'fullScreen', const Duration(milliseconds: 800), () async {
|
||||||
|
await _.triggerFullScreen(status: status);
|
||||||
|
});
|
||||||
|
}
|
||||||
if (cumulativeDy > threshold) {
|
if (cumulativeDy > threshold) {
|
||||||
_gestureType = 'center_down';
|
_gestureType = 'center_down';
|
||||||
|
if (_.isFullScreen.value ^ fullScreenGestureReverse) {
|
||||||
|
fullScreenTrigger(fullScreenGestureReverse);
|
||||||
|
}
|
||||||
// print('center_down:$cumulativeDy');
|
// print('center_down:$cumulativeDy');
|
||||||
} else if (cumulativeDy < -threshold) {
|
} else if (cumulativeDy < -threshold) {
|
||||||
_gestureType = 'center_up';
|
_gestureType = 'center_up';
|
||||||
|
if (!_.isFullScreen.value ^ fullScreenGestureReverse) {
|
||||||
|
fullScreenTrigger(!fullScreenGestureReverse);
|
||||||
|
}
|
||||||
// print('center_up:$cumulativeDy');
|
// print('center_up:$cumulativeDy');
|
||||||
}
|
}
|
||||||
} else if (_gestureType == 'right') {
|
} else if (_gestureType == 'right') {
|
||||||
@@ -627,22 +640,6 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
|||||||
_.onChangedSliderEnd();
|
_.onChangedSliderEnd();
|
||||||
_.seekTo(_.sliderPosition.value, type: 'slider');
|
_.seekTo(_.sliderPosition.value, type: 'slider');
|
||||||
}
|
}
|
||||||
void fullScreenTrigger(bool status) {
|
|
||||||
EasyThrottle.throttle(
|
|
||||||
'fullScreen', const Duration(milliseconds: 500), () async {
|
|
||||||
await _.triggerFullScreen(status: status);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_gestureType == 'center_down') {
|
|
||||||
if (_.isFullScreen.value ^ fullScreenGestureReverse) {
|
|
||||||
fullScreenTrigger(fullScreenGestureReverse);
|
|
||||||
}
|
|
||||||
} else if (_gestureType == 'center_up') {
|
|
||||||
if (!_.isFullScreen.value ^ fullScreenGestureReverse) {
|
|
||||||
fullScreenTrigger(!fullScreenGestureReverse);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
interacting = false;
|
interacting = false;
|
||||||
_initialFocalPoint = Offset.zero;
|
_initialFocalPoint = Offset.zero;
|
||||||
_gestureType = null;
|
_gestureType = null;
|
||||||
|
|||||||
Reference in New Issue
Block a user