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',