From 66619672767e328a88ed8baf24bdf1925cd99e75 Mon Sep 17 00:00:00 2001 From: orz12 Date: Sat, 6 Apr 2024 09:32:19 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E6=92=AD=E6=94=BE?= =?UTF-8?q?=E9=A1=B5=E9=87=8D=E5=8A=9B=E6=84=9F=E5=BA=94=E5=B1=8F=E8=94=BD?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/setting/play_setting.dart | 6 ++++++ lib/plugin/pl_player/utils/fullscreen.dart | 6 ++++++ lib/utils/storage.dart | 1 + 3 files changed, 13 insertions(+) diff --git a/lib/pages/setting/play_setting.dart b/lib/pages/setting/play_setting.dart index 000dd0ee..2f75ebe8 100644 --- a/lib/pages/setting/play_setting.dart +++ b/lib/pages/setting/play_setting.dart @@ -131,6 +131,12 @@ class _PlaySettingState extends State { setKey: SettingBoxKey.enableAutoExit, defaultVal: true, ), + const SetSwitchItem( + title: '全向旋转', + subTitle: '非全屏时可受重力转为临时全屏,若系统锁定旋转仍异常触发请关闭,无异常可保持开启', + setKey: SettingBoxKey.allowRotateScreen, + defaultVal: true, + ), const SetSwitchItem( title: '后台播放', subTitle: '进入后台时继续播放', diff --git a/lib/plugin/pl_player/utils/fullscreen.dart b/lib/plugin/pl_player/utils/fullscreen.dart index 7f354c49..ad35c84b 100644 --- a/lib/plugin/pl_player/utils/fullscreen.dart +++ b/lib/plugin/pl_player/utils/fullscreen.dart @@ -5,6 +5,8 @@ import 'package:auto_orientation/auto_orientation.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/services.dart'; +import '../../../utils/storage.dart'; + //横屏 Future landScape() async { dynamic document; @@ -44,6 +46,10 @@ Future verticalScreen() async { //全向 Future autoScreen() async { + if (!GStrorage.setting + .get(SettingBoxKey.allowRotateScreen, defaultValue: true)) { + return; + } await SystemChrome.setPreferredOrientations([ DeviceOrientation.portraitUp, DeviceOrientation.portraitDown, diff --git a/lib/utils/storage.dart b/lib/utils/storage.dart index 0932a23c..7239c876 100644 --- a/lib/utils/storage.dart +++ b/lib/utils/storage.dart @@ -94,6 +94,7 @@ class SettingBoxKey { enableAutoBrightness = 'enableAutoBrightness', enableAutoEnter = 'enableAutoEnter', enableAutoExit = 'enableAutoExit', + allowRotateScreen = 'allowRotateScreen', horizontalScreen = 'horizontalScreen', p1080 = 'p1080', enableCDN = 'enableCDN',