diff --git a/lib/pages/setting/models/play_settings.dart b/lib/pages/setting/models/play_settings.dart index 15638553f..28cac8a5d 100644 --- a/lib/pages/setting/models/play_settings.dart +++ b/lib/pages/setting/models/play_settings.dart @@ -309,4 +309,13 @@ List get playSettings => [ setKey: SettingBoxKey.tempPlayerConf, defaultVal: false, ), + if (Utils.isDesktop) + const SettingsModel( + settingsType: SettingsType.sw1tch, + title: '独占全屏', + subtitle: '关闭为应用内全屏', + leading: Icon(Icons.zoom_out_map_rounded), + setKey: SettingBoxKey.nativeFullscreen, + defaultVal: true, + ), ]; diff --git a/lib/plugin/pl_player/utils/fullscreen.dart b/lib/plugin/pl_player/utils/fullscreen.dart index aacc44d0a..cbe4627aa 100644 --- a/lib/plugin/pl_player/utils/fullscreen.dart +++ b/lib/plugin/pl_player/utils/fullscreen.dart @@ -15,7 +15,7 @@ Future landScape() async { await document.documentElement?.requestFullscreen(); } else if (Utils.isMobile) { await AutoOrientation.landscapeAutoMode(forceSensor: true); - } else if (Utils.isDesktop) { + } else if (Utils.isDesktop && Pref.nativeFullscreen) { await const MethodChannel( 'com.alexmercerind/media_kit_video', ).invokeMethod( @@ -94,17 +94,14 @@ Future showStatusBar() async { mode, overlays: SystemUiOverlay.values, ); - } else if (Utils.isDesktop) { + } else if (Utils.isDesktop && Pref.nativeFullscreen) { await const MethodChannel( 'com.alexmercerind/media_kit_video', ).invokeMethod( 'Utils.ExitNativeFullscreen', ); } - } catch (exception, stacktrace) { - if (kDebugMode) { - debugPrint(exception.toString()); - debugPrint(stacktrace.toString()); - } + } catch (_) { + if (kDebugMode) rethrow; } } diff --git a/lib/utils/storage_key.dart b/lib/utils/storage_key.dart index 7f81b4047..a6d388f94 100644 --- a/lib/utils/storage_key.dart +++ b/lib/utils/storage_key.dart @@ -213,7 +213,8 @@ abstract class SettingBoxKey { enableGradientBg = 'enableGradientBg', navBarSort = 'navBarSort', tempPlayerConf = 'tempPlayerConf', - reduceLuxColor = 'reduceLuxColor'; + reduceLuxColor = 'reduceLuxColor', + nativeFullscreen = 'nativeFullscreen'; } abstract class LocalCacheKey { diff --git a/lib/utils/storage_pref.dart b/lib/utils/storage_pref.dart index 5ca97d30d..ed4106b52 100644 --- a/lib/utils/storage_pref.dart +++ b/lib/utils/storage_pref.dart @@ -832,4 +832,7 @@ abstract class Pref { static bool get keyboardControl => _setting.get(SettingBoxKey.keyboardControl, defaultValue: true); + + static bool get nativeFullscreen => + _setting.get(SettingBoxKey.nativeFullscreen, defaultValue: true); }