refactor device orientation

Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
dom
2026-04-06 15:16:21 +08:00
parent db74eccf77
commit 3097b56816
16 changed files with 218 additions and 264 deletions

View File

@@ -78,12 +78,12 @@ abstract final class ImageUtils {
}
}
static Future<bool> checkPermissionDependOnSdkInt() async {
static Future<bool> checkPermissionDependOnSdkInt() {
if (Platform.isAndroid) {
if (await Utils.sdkInt < 29) {
if (Utils.sdkInt < 29) {
return requestPer();
} else {
return true;
return Future.syncValue(true);
}
}
return requestPer();

View File

@@ -32,7 +32,6 @@ abstract final class SettingBoxKey {
static const String enableVerticalExpand = 'enableVerticalExpand',
feedBackEnable = 'feedBackEnable',
enableLongShowControl = 'enableLongShowControl',
allowRotateScreen = 'allowRotateScreen',
horizontalScreen = 'horizontalScreen',
CDNService = 'CDNService',
disableAudioCDN = 'disableAudioCDN',

View File

@@ -193,7 +193,9 @@ abstract final class Pref {
static FullScreenMode get fullScreenMode =>
FullScreenMode.values[_setting.get(
SettingBoxKey.fullScreenMode,
defaultValue: FullScreenMode.auto.index,
defaultValue: horizontalScreen
? FullScreenMode.none.index
: FullScreenMode.auto.index,
)];
static BtmProgressBehavior get btmProgressBehavior =>
@@ -636,9 +638,6 @@ abstract final class Pref {
static bool get enableBackgroundPlay =>
_setting.get(SettingBoxKey.enableBackgroundPlay, defaultValue: true);
static bool get allowRotateScreen =>
_setting.get(SettingBoxKey.allowRotateScreen, defaultValue: true);
static bool get disableLikeMsg =>
_setting.get(SettingBoxKey.disableLikeMsg, defaultValue: false);

View File

@@ -87,10 +87,7 @@ abstract final class Utils {
int.parse('${color.substring(7)}${color.substring(1, 7)}', radix: 16),
);
static int? _sdkInt;
static Future<int> get sdkInt async {
return _sdkInt ??= (await DeviceInfoPlugin().androidInfo).version.sdkInt;
}
static late int sdkInt;
static bool? _isIpad;
static Future<bool> get isIpad async {