feat: inapp fullscreen (#1330)

This commit is contained in:
My-Responsitories
2025-09-26 00:18:11 +08:00
committed by GitHub
parent 4ae3bd2845
commit 5fd3d32200
4 changed files with 18 additions and 8 deletions

View File

@@ -309,4 +309,13 @@ List<SettingsModel> 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,
),
];

View File

@@ -15,7 +15,7 @@ Future<void> 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<void> 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;
}
}

View File

@@ -213,7 +213,8 @@ abstract class SettingBoxKey {
enableGradientBg = 'enableGradientBg',
navBarSort = 'navBarSort',
tempPlayerConf = 'tempPlayerConf',
reduceLuxColor = 'reduceLuxColor';
reduceLuxColor = 'reduceLuxColor',
nativeFullscreen = 'nativeFullscreen';
}
abstract class LocalCacheKey {

View File

@@ -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);
}