Merge branch 'main' into feature-minePage

This commit is contained in:
guozhigq
2024-10-16 14:17:24 +08:00
parent 676b2f18eb
commit 174eff7151
62 changed files with 1738 additions and 1371 deletions

View File

@ -1045,6 +1045,14 @@ class PlPlayerController {
/// 缓存本次弹幕选项
cacheDanmakuOption() {
final cache = GlobalDataCache();
cache.blockTypes = blockTypes;
cache.showArea = showArea;
cache.opacityVal = opacityVal;
cache.fontSizeVal = fontSizeVal;
cache.danmakuDurationVal = danmakuDurationVal;
cache.strokeWidth = strokeWidth;
localCache.put(LocalCacheKey.danmakuBlockType, blockTypes);
localCache.put(LocalCacheKey.danmakuShowArea, showArea);
localCache.put(LocalCacheKey.danmakuOpacity, opacityVal);

View File

@ -204,6 +204,11 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
widget.controller.brightness.value = value;
}
bool isUsingFullScreenGestures(double tapPosition, double sectionWidth) {
return fullScreenGestureMode != FullScreenGestureMode.none &&
tapPosition < sectionWidth * 2;
}
@override
void dispose() {
animationController.dispose();
@ -638,7 +643,10 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
onVerticalDragUpdate: (DragUpdateDetails details) async {
final double totalWidth = MediaQuery.sizeOf(context).width;
final double tapPosition = details.localPosition.dx;
final double sectionWidth = totalWidth / 3;
final double sectionWidth =
fullScreenGestureMode == FullScreenGestureMode.none
? totalWidth / 2
: totalWidth / 3;
final double delta = details.delta.dy;
/// 锁定时禁用
@ -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) {