From 7bf9acb0cbf38041c0ff6f44c773b83710c3304e Mon Sep 17 00:00:00 2001 From: orz12 Date: Sat, 27 Jan 2024 00:44:19 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=8A=98=E5=8F=A0=E5=B1=8F=E5=86=85?= =?UTF-8?q?=E5=B1=8F=EF=BC=88=E5=B1=95=E5=BC=80=E7=8A=B6=E6=80=81=EF=BC=89?= =?UTF-8?q?=E7=AB=96=E5=B1=8F=E5=85=A8=E5=B1=8F=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/plugin/pl_player/controller.dart | 8 +++++--- lib/plugin/pl_player/models/fullscreen_mode.dart | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/plugin/pl_player/controller.dart b/lib/plugin/pl_player/controller.dart index f7b0c7e2..6a1735b5 100644 --- a/lib/plugin/pl_player/controller.dart +++ b/lib/plugin/pl_player/controller.dart @@ -278,8 +278,7 @@ class PlPlayerController { danmakuDurationVal = localCache.get(LocalCacheKey.danmakuDuration, defaultValue: 4.0); // 描边粗细 - strokeWidth = - localCache.get(LocalCacheKey.strokeWidth, defaultValue: 1.5); + strokeWidth = localCache.get(LocalCacheKey.strokeWidth, defaultValue: 1.5); playRepeat = PlayRepeat.values.toList().firstWhere( (e) => e.value == @@ -952,7 +951,10 @@ class PlPlayerController { /// 进入全屏 await enterFullScreen(); if (mode == FullScreenMode.vertical || - (mode == FullScreenMode.auto && direction.value == 'vertical')) { + (mode == FullScreenMode.auto && direction.value == 'vertical') || + (mode == FullScreenMode.ratio && + (Get.height / Get.width < 1.25 || + direction.value == 'vertical'))) { await verticalScreen(); } else { await landScape(); diff --git a/lib/plugin/pl_player/models/fullscreen_mode.dart b/lib/plugin/pl_player/models/fullscreen_mode.dart index 9b5028e7..de5503bb 100644 --- a/lib/plugin/pl_player/models/fullscreen_mode.dart +++ b/lib/plugin/pl_player/models/fullscreen_mode.dart @@ -5,15 +5,17 @@ enum FullScreenMode { // 始终竖屏 vertical, // 始终横屏 - horizontal + horizontal, + // 屏幕长宽比<1.25或为竖屏视频时竖屏,否则横屏 + ratio, } extension FullScreenModeDesc on FullScreenMode { - String get description => ['自适应', '始终竖屏', '始终横屏'][index]; + String get description => ['按视频方向(默认)', '强制竖屏', '强制横屏', '屏幕长宽比<1.25或为竖屏视频时竖屏,否则横屏'][index]; } extension FullScreenModeCode on FullScreenMode { - static final List _codeList = [0, 1, 2]; + static final List _codeList = [0, 1, 2, 3]; int get code => _codeList[index]; static FullScreenMode? fromCode(int code) {