opt get horizontalScreen

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-05-18 15:01:49 +08:00
parent 4d430ba42c
commit 805a63cf59

View File

@@ -57,14 +57,12 @@ class GStorage {
); );
static List<String> get tabbarSort => static List<String> get tabbarSort =>
List<String>.from(setting.get(SettingBoxKey.tabbarSort, List<String>.from(setting.get(SettingBoxKey.tabbarSort) ??
defaultValue: HomeTabType.values.map((item) => item.name).toList())); HomeTabType.values.map((item) => item.name).toList());
static List<Pair<SegmentType, SkipType>> get blockSettings { static List<Pair<SegmentType, SkipType>> get blockSettings {
List<int> list = List<int>.from(setting.get( List<int> list = List<int>.from(setting.get(SettingBoxKey.blockSettings) ??
SettingBoxKey.blockSettings, List.generate(SegmentType.values.length, (_) => 1));
defaultValue: List.generate(SegmentType.values.length, (_) => 1),
));
return SegmentType.values return SegmentType.values
.map((item) => Pair<SegmentType, SkipType>( .map((item) => Pair<SegmentType, SkipType>(
first: item, first: item,
@@ -74,10 +72,9 @@ class GStorage {
} }
static List<Color> get blockColor { static List<Color> get blockColor {
List<String> list = List<String>.from(setting.get( List<String> list = List<String>.from(
SettingBoxKey.blockColor, setting.get(SettingBoxKey.blockColor) ??
defaultValue: List.generate(SegmentType.values.length, (_) => ''), List.generate(SegmentType.values.length, (_) => ''));
));
return SegmentType.values return SegmentType.values
.map((item) => list[item.index].isNotEmpty .map((item) => list[item.index].isNotEmpty
? Color( ? Color(
@@ -473,13 +470,17 @@ class GStorage {
SettingBoxKey.pageTransition, SettingBoxKey.pageTransition,
defaultValue: Transition.native.index)]; defaultValue: Transition.native.index)];
static num get maxCacheSize => GStorage.setting static num get maxCacheSize =>
.get(SettingBoxKey.maxCacheSize, defaultValue: pow(1024, 3)); GStorage.setting.get(SettingBoxKey.maxCacheSize) ?? pow(1024, 3);
static bool get optTabletNav => static bool get optTabletNav =>
GStorage.setting.get(SettingBoxKey.optTabletNav, defaultValue: true); GStorage.setting.get(SettingBoxKey.optTabletNav, defaultValue: true);
static bool get horizontalScreen { static bool get horizontalScreen {
return GStorage.setting.get(SettingBoxKey.horizontalScreen) ?? isTablet;
}
static bool get isTablet {
bool isTablet; bool isTablet;
if (Get.context != null) { if (Get.context != null) {
isTablet = Get.context!.isTablet; isTablet = Get.context!.isTablet;
@@ -489,15 +490,14 @@ class GStorage {
final shortestSide = min(screenSize.width.abs(), screenSize.height.abs()); final shortestSide = min(screenSize.width.abs(), screenSize.height.abs());
isTablet = shortestSide >= 600; isTablet = shortestSide >= 600;
} }
return GStorage.setting return isTablet;
.get(SettingBoxKey.horizontalScreen, defaultValue: isTablet);
} }
static List<double> get dynamicDetailRatio => List<double>.from(setting static List<double> get dynamicDetailRatio => List<double>.from(setting
.get(SettingBoxKey.dynamicDetailRatio, defaultValue: const [60.0, 40.0])); .get(SettingBoxKey.dynamicDetailRatio, defaultValue: const [60.0, 40.0]));
static Set<int> get blackMids => static Set<int> get blackMids => GStorage.localCache
GStorage.localCache.get(LocalCacheKey.blackMids, defaultValue: <int>{}); .get(LocalCacheKey.blackMids, defaultValue: const <int>{});
static set blackMids(Set<int> blackMidsSet) { static set blackMids(Set<int> blackMidsSet) {
GStorage.localCache.put(LocalCacheKey.blackMids, blackMidsSet); GStorage.localCache.put(LocalCacheKey.blackMids, blackMidsSet);
@@ -535,10 +535,8 @@ class GStorage {
// ); // );
// damping = ratio * 2.0 * math.sqrt(mass * stiffness) // damping = ratio * 2.0 * math.sqrt(mass * stiffness)
static final List<double> springDescription = List<double>.from( static final List<double> springDescription = List<double>.from(
setting.get( setting.get(SettingBoxKey.springDescription) ??
SettingBoxKey.springDescription, // [mass, stiffness, damping] [0.5, 100.0, 2.2 * sqrt(50)], // [mass, stiffness, damping]
defaultValue: [0.5, 100.0, 2.2 * sqrt(50)],
),
); );
// static Brightness get brightness { // static Brightness get brightness {