feat: 折叠屏内屏(展开状态)竖屏全屏适配

This commit is contained in:
orz12
2024-01-27 00:44:19 +08:00
parent 1da311ccb5
commit 7bf9acb0cb
2 changed files with 10 additions and 6 deletions

View File

@@ -278,8 +278,7 @@ class PlPlayerController {
danmakuDurationVal = danmakuDurationVal =
localCache.get(LocalCacheKey.danmakuDuration, defaultValue: 4.0); localCache.get(LocalCacheKey.danmakuDuration, defaultValue: 4.0);
// 描边粗细 // 描边粗细
strokeWidth = strokeWidth = localCache.get(LocalCacheKey.strokeWidth, defaultValue: 1.5);
localCache.get(LocalCacheKey.strokeWidth, defaultValue: 1.5);
playRepeat = PlayRepeat.values.toList().firstWhere( playRepeat = PlayRepeat.values.toList().firstWhere(
(e) => (e) =>
e.value == e.value ==
@@ -952,7 +951,10 @@ class PlPlayerController {
/// 进入全屏 /// 进入全屏
await enterFullScreen(); await enterFullScreen();
if (mode == FullScreenMode.vertical || 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(); await verticalScreen();
} else { } else {
await landScape(); await landScape();

View File

@@ -5,15 +5,17 @@ enum FullScreenMode {
// 始终竖屏 // 始终竖屏
vertical, vertical,
// 始终横屏 // 始终横屏
horizontal horizontal,
// 屏幕长宽比<1.25或为竖屏视频时竖屏,否则横屏
ratio,
} }
extension FullScreenModeDesc on FullScreenMode { extension FullScreenModeDesc on FullScreenMode {
String get description => ['自适应', '始终竖屏', '始终横屏'][index]; String get description => ['按视频方向(默认)', '强制竖屏', '强制横屏', '屏幕长宽比<1.25或为竖屏视频时竖屏,否则横屏'][index];
} }
extension FullScreenModeCode on FullScreenMode { extension FullScreenModeCode on FullScreenMode {
static final List<int> _codeList = [0, 1, 2]; static final List<int> _codeList = [0, 1, 2, 3];
int get code => _codeList[index]; int get code => _codeList[index];
static FullScreenMode? fromCode(int code) { static FullScreenMode? fromCode(int code) {