From 8c1a34c133edbf104810485231db9a4d90dd0fef Mon Sep 17 00:00:00 2001 From: orz12 Date: Sat, 27 Jan 2024 01:27:01 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=EF=BC=9A=E6=A8=AA=E5=B1=8F=E6=97=B6=E8=BF=94=E5=9B=9E=E5=8F=AF?= =?UTF-8?q?=E4=BB=A5=E7=9B=B4=E6=8E=A5=E8=BF=94=E5=9B=9E=E4=B8=BA=E6=A8=AA?= =?UTF-8?q?=E5=B1=8F=E9=A1=B5=E9=9D=A2=EF=BC=8C=E6=97=A0=E9=9C=80=E7=BB=8F?= =?UTF-8?q?=E8=BF=87=E7=AB=96=E5=B1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/setting/play_setting.dart | 6 ++++++ lib/pages/video/detail/view.dart | 6 +++++- lib/pages/video/detail/widgets/header_control.dart | 4 +++- lib/plugin/pl_player/controller.dart | 4 +++- lib/utils/storage.dart | 1 + 5 files changed, 18 insertions(+), 3 deletions(-) diff --git a/lib/pages/setting/play_setting.dart b/lib/pages/setting/play_setting.dart index bfd5db5f..768f576c 100644 --- a/lib/pages/setting/play_setting.dart +++ b/lib/pages/setting/play_setting.dart @@ -116,6 +116,12 @@ class _PlaySettingState extends State { setKey: SettingBoxKey.enableAutoExit, defaultVal: false, ), + const SetSwitchItem( + title: '恢复竖屏', + subTitle: '退出全屏视频时自动恢复竖屏,关闭可以保持横屏状态', + setKey: SettingBoxKey.exitFullscreenAutoVertical, + defaultVal: true, + ), const SetSwitchItem( title: '开启硬解', subTitle: '以较低功耗播放视频', diff --git a/lib/pages/video/detail/view.dart b/lib/pages/video/detail/view.dart index 3644fa41..320a3c8a 100644 --- a/lib/pages/video/detail/view.dart +++ b/lib/pages/video/detail/view.dart @@ -57,6 +57,7 @@ class _VideoDetailPageState extends State // 自动退出全屏 late bool autoExitFullcreen; late bool autoPlayEnable; + late bool exitFullscreenAutoVertical; late bool autoPiP; final Floating floating = Floating(); // 生命周期监听 @@ -85,6 +86,8 @@ class _VideoDetailPageState extends State statusBarHeight = localCache.get('statusBarHeight'); autoExitFullcreen = setting.get(SettingBoxKey.enableAutoExit, defaultValue: false); + exitFullscreenAutoVertical = setting + .get(SettingBoxKey.exitFullscreenAutoVertical, defaultValue: true); autoPlayEnable = setting.get(SettingBoxKey.autoPlayEnable, defaultValue: true); autoPiP = setting.get(SettingBoxKey.autoPiP, defaultValue: false); @@ -345,7 +348,8 @@ class _VideoDetailPageState extends State .triggerFullScreen(status: false); } if (MediaQuery.of(context).orientation == - Orientation.landscape) { + Orientation.landscape && + exitFullscreenAutoVertical) { verticalScreen(); } }, diff --git a/lib/pages/video/detail/widgets/header_control.dart b/lib/pages/video/detail/widgets/header_control.dart index 80643245..8c06d415 100644 --- a/lib/pages/video/detail/widgets/header_control.dart +++ b/lib/pages/video/detail/widgets/header_control.dart @@ -1069,7 +1069,9 @@ class _HeaderControlState extends State { else { if (MediaQuery.of(context).orientation == - Orientation.landscape) + Orientation.landscape && + setting.get(SettingBoxKey.exitFullscreenAutoVertical, + defaultValue: true)) { SystemChrome.setPreferredOrientations([ DeviceOrientation.portraitUp, diff --git a/lib/plugin/pl_player/controller.dart b/lib/plugin/pl_player/controller.dart index 6a1735b5..e4ab6054 100644 --- a/lib/plugin/pl_player/controller.dart +++ b/lib/plugin/pl_player/controller.dart @@ -995,7 +995,9 @@ class PlPlayerController { StatusBarControl.setHidden(false, animation: StatusBarAnimation.FADE); // Get.back(); exitFullScreen(); - await verticalScreen(); + if (setting.get(SettingBoxKey.exitFullscreenAutoVertical, defaultValue: true)) { + await verticalScreen(); + } toggleFullScreen(false); } } diff --git a/lib/utils/storage.dart b/lib/utils/storage.dart index fb9bc180..5fbe988b 100644 --- a/lib/utils/storage.dart +++ b/lib/utils/storage.dart @@ -107,6 +107,7 @@ class SettingBoxKey { enableAutoBrightness = 'enableAutoBrightness', enableAutoEnter = 'enableAutoEnter', enableAutoExit = 'enableAutoExit', + exitFullscreenAutoVertical = 'exitFullscreenAutoVertical', p1080 = 'p1080', enableCDN = 'enableCDN', autoPiP = 'autoPiP',