refactor: GlobalDataCache

This commit is contained in:
guozhigq
2024-11-19 23:50:45 +08:00
parent 606a3ad495
commit 16fa467742
22 changed files with 79 additions and 84 deletions

View File

@ -11,48 +11,48 @@ Box videoStorage = GStorage.video;
Box userInfoCache = GStorage.userInfo;
class GlobalDataCache {
late int imgQuality;
late FullScreenGestureMode fullScreenGestureMode;
late bool enablePlayerControlAnimation;
late List<String> actionTypeSort;
late double sheetHeight;
String? wWebid;
static late int imgQuality;
static late FullScreenGestureMode fullScreenGestureMode;
static late bool enablePlayerControlAnimation;
static late List<String> actionTypeSort;
static late double sheetHeight;
static String? wWebid;
/// 播放器相关
// 弹幕开关
late bool isOpenDanmu;
static late bool isOpenDanmu;
// 弹幕屏蔽类型
late List<dynamic> blockTypes;
static late List<dynamic> blockTypes;
// 弹幕展示区域
late double showArea;
static late double showArea;
// 弹幕透明度
late double opacityVal;
static late double opacityVal;
// 弹幕字体大小
late double fontSizeVal;
static late double fontSizeVal;
// 弹幕显示时间
late double danmakuDurationVal;
static late double danmakuDurationVal;
// 弹幕描边宽度
late double strokeWidth;
static late double strokeWidth;
// 播放器循环模式
late PlayRepeat playRepeat;
static late PlayRepeat playRepeat;
// 播放器默认播放速度
late double playbackSpeed;
static late double playbackSpeed;
// 播放器自动长按速度
late bool enableAutoLongPressSpeed;
static late bool enableAutoLongPressSpeed;
// 播放器长按速度
late double longPressSpeed;
static late double longPressSpeed;
// 播放器速度列表
late List<double> speedsList;
static late List<double> speedsList;
// 用户信息
UserInfoData? userInfo;
static UserInfoData? userInfo;
// 搜索历史
late List historyCacheList;
//
late bool enableSearchSuggest = true;
static late List historyCacheList;
// 搜索建议
static late bool enableSearchSuggest;
// 简介默认展开
late bool enableAutoExpand = false;
//
late bool enableDynamicSwitch = true;
static late bool enableAutoExpand;
// 动态切换
static late bool enableDynamicSwitch;
// 私有构造函数
GlobalDataCache._();
@ -64,7 +64,7 @@ class GlobalDataCache {
factory GlobalDataCache() => _instance;
// 异步初始化方法
Future<void> initialize() async {
static Future<void> initialize() async {
imgQuality = await setting.get(SettingBoxKey.defaultPicQa,
defaultValue: 10); // 设置全局变量
fullScreenGestureMode = FullScreenGestureMode.values[setting.get(