Merge branch 'main' into design

This commit is contained in:
guozhigq
2024-11-23 23:34:07 +08:00
24 changed files with 111 additions and 100 deletions

View File

@ -308,7 +308,7 @@ class UpItemWidget extends StatelessWidget {
if (data.type == 'up') {
EasyThrottle.throttle('follow', const Duration(milliseconds: 300),
() {
if (GlobalDataCache().enableDynamicSwitch) {
if (GlobalDataCache.enableDynamicSwitch) {
onClickUp(data, index);
} else {
onClickUpAni(data, index);

View File

@ -125,7 +125,7 @@ class _MainAppState extends State<MainApp> with SingleTickerProviderStateMixin {
double sheetHeight = MediaQuery.sizeOf(context).height -
MediaQuery.of(context).padding.top -
MediaQuery.sizeOf(context).width * 9 / 16;
GlobalDataCache().sheetHeight = sheetHeight;
GlobalDataCache.sheetHeight = sheetHeight;
localCache.put('sheetHeight', sheetHeight);
localCache.put('statusBarHeight', statusBarHeight);

View File

@ -28,9 +28,8 @@ class MemberArchiveController extends GetxController {
super.onInit();
mid = int.parse(Get.parameters['mid']!);
currentOrder.value = orderList.first;
ownerMid = GlobalDataCache().userInfo != null
? GlobalDataCache().userInfo!.mid!
: -1;
ownerMid =
GlobalDataCache.userInfo != null ? GlobalDataCache.userInfo!.mid! : -1;
isOwner.value = mid == -1 || mid == ownerMid;
}

View File

@ -20,9 +20,8 @@ class MemberArticleController extends GetxController {
void onInit() {
super.onInit();
mid = int.parse(Get.parameters['mid']!);
ownerMid = GlobalDataCache().userInfo != null
? GlobalDataCache().userInfo!.mid!
: -1;
ownerMid =
GlobalDataCache.userInfo != null ? GlobalDataCache.userInfo!.mid! : -1;
isOwner.value = mid == -1 || mid == ownerMid;
}

View File

@ -18,9 +18,8 @@ class MemberDynamicsController extends GetxController {
void onInit() {
super.onInit();
mid = int.parse(Get.parameters['mid']!);
ownerMid = GlobalDataCache().userInfo != null
? GlobalDataCache().userInfo!.mid!
: -1;
ownerMid =
GlobalDataCache.userInfo != null ? GlobalDataCache.userInfo!.mid! : -1;
isOwner.value = mid == -1 || mid == ownerMid;
}

View File

@ -59,7 +59,7 @@ class MemberSeasonsController extends GetxController {
mid: mid,
seriesId: seriesId!,
pn: pn,
currentMid: GlobalDataCache().userInfo?.mid ?? -1,
currentMid: GlobalDataCache.userInfo?.mid ?? -1,
);
if (res['status']) {
seasonsList.addAll(res['data'].seriesList);

View File

@ -43,10 +43,10 @@ class SSearchController extends GetxController {
hintText = hint;
}
}
historyCacheList = GlobalDataCache().historyCacheList;
historyCacheList = GlobalDataCache.historyCacheList;
historyList.value = historyCacheList;
enableHotKey = setting.get(SettingBoxKey.enableHotKey, defaultValue: true);
enableSearchSuggest = GlobalDataCache().enableSearchSuggest;
enableSearchSuggest = GlobalDataCache.enableSearchSuggest;
}
void onChange(value) {
@ -128,7 +128,7 @@ class SSearchController extends GetxController {
historyCacheList = [];
historyList.refresh();
localCache.put('cacheList', []);
GlobalDataCache().historyCacheList = [];
GlobalDataCache.historyCacheList = [];
SmartDialog.showToast('搜索历史已清空');
}
@ -139,7 +139,7 @@ class SSearchController extends GetxController {
historyList.value = historyCacheList;
historyList.refresh();
localCache.put('cacheList', historyCacheList);
GlobalDataCache().historyCacheList = historyCacheList;
GlobalDataCache.historyCacheList = historyCacheList;
searchFocusNode.unfocus();
}
}

View File

@ -146,7 +146,7 @@ class _ExtraSettingState extends State<ExtraSetting> {
setKey: SettingBoxKey.enableSearchSuggest,
defaultVal: true,
callFn: (val) {
GlobalDataCache().enableSearchSuggest = val;
GlobalDataCache.enableSearchSuggest = val;
},
),
SetSwitchItem(
@ -181,7 +181,7 @@ class _ExtraSettingState extends State<ExtraSetting> {
setKey: SettingBoxKey.enableAutoExpand,
defaultVal: false,
callFn: (val) {
GlobalDataCache().enableAutoExpand = val;
GlobalDataCache.enableAutoExpand = val;
},
),
const SetSwitchItem(
@ -190,6 +190,15 @@ class _ExtraSettingState extends State<ExtraSetting> {
setKey: SettingBoxKey.enableRelatedVideo,
defaultVal: true,
),
SetSwitchItem(
title: '视频投屏开关',
subTitle: '打开后将在播放器右上角显示投屏入口',
setKey: SettingBoxKey.enableDlna,
defaultVal: false,
callFn: (bool val) {
GlobalDataCache.enableDlna = val;
},
),
ListTile(
dense: false,
title: Text('评论展示', style: titleStyle),

View File

@ -38,7 +38,7 @@ class _ActionMenuSetPageState extends State<ActionMenuSetPage> {
.map<String>((i) => (i['value'] as ActionType).value)
.toList();
setting.put(SettingBoxKey.actionTypeSort, sortedTabbar);
GlobalDataCache().actionTypeSort = sortedTabbar;
GlobalDataCache.actionTypeSort = sortedTabbar;
SmartDialog.showToast('操作成功');
}

View File

@ -58,11 +58,11 @@ class _PlayGesturePageState extends State<PlayGesturePage> {
},
);
if (result != null) {
GlobalDataCache().fullScreenGestureMode = FullScreenGestureMode
GlobalDataCache.fullScreenGestureMode = FullScreenGestureMode
.values
.firstWhere((element) => element.values == result);
fullScreenGestureMode =
GlobalDataCache().fullScreenGestureMode.index;
GlobalDataCache.fullScreenGestureMode.index;
setting.put(
SettingBoxKey.fullScreenGestureMode, fullScreenGestureMode);
SmartDialog.showToast('设置成功');

View File

@ -155,7 +155,7 @@ class _PlaySettingState extends State<PlaySetting> {
setKey: SettingBoxKey.enablePlayerControlAnimation,
defaultVal: true,
callFn: (bool val) {
GlobalDataCache().enablePlayerControlAnimation = val;
GlobalDataCache.enablePlayerControlAnimation = val;
}),
SetSwitchItem(
title: '港澳台模式',

View File

@ -175,7 +175,7 @@ class _StyleSettingState extends State<StyleSetting> {
SettingBoxKey.defaultPicQa, picQuality);
Get.back();
settingController.picQuality.value = picQuality;
GlobalDataCache().imgQuality = picQuality;
GlobalDataCache.imgQuality = picQuality;
SmartDialog.showToast('设置成功');
},
child: const Text('确定'),

View File

@ -158,8 +158,8 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
owner = widget.videoDetail!.owner;
enableAi = setting.get(SettingBoxKey.enableAi, defaultValue: true);
_expandableCtr = ExpandableController(
initialExpanded: GlobalDataCache().enableAutoExpand);
_expandableCtr =
ExpandableController(initialExpanded: GlobalDataCache.enableAutoExpand);
}
// 收藏
@ -545,7 +545,7 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
}
Widget actionGrid(BuildContext context, videoIntroController) {
final actionTypeSort = GlobalDataCache().actionTypeSort;
final actionTypeSort = GlobalDataCache.actionTypeSort;
Map<String, Widget> menuListWidgets = {
'like': Obx(

View File

@ -52,7 +52,7 @@ class ReplyItem extends StatelessWidget {
@override
Widget build(BuildContext context) {
final bool isOwner = int.parse(replyItem!.member!.mid!) ==
(GlobalDataCache().userInfo?.mid ?? -1);
(GlobalDataCache.userInfo?.mid ?? -1);
return Material(
child: InkWell(
// 点击整个评论区 评论详情/回复
@ -415,7 +415,7 @@ class ReplyItemRow extends StatelessWidget {
onLongPress: () {
feedBack();
final bool isOwner = int.parse(replyItem!.member!.mid!) ==
(GlobalDataCache().userInfo?.mid ?? -1);
(GlobalDataCache.userInfo?.mid ?? -1);
showModalBottomSheet(
context: context,
useRootNavigator: true,

View File

@ -18,7 +18,7 @@ class AiDetail extends StatelessWidget {
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.only(left: 16, right: 16),
height: GlobalDataCache().sheetHeight,
height: GlobalDataCache.sheetHeight,
child: Column(
children: [
_buildHeader(context),

View File

@ -16,6 +16,7 @@ import 'package:pilipala/pages/video/detail/index.dart';
import 'package:pilipala/pages/video/detail/introduction/widgets/menu_row.dart';
import 'package:pilipala/plugin/pl_player/index.dart';
import 'package:pilipala/plugin/pl_player/models/play_repeat.dart';
import 'package:pilipala/utils/global_data_cache.dart';
import 'package:pilipala/utils/storage.dart';
import 'package:pilipala/services/shutdown_timer_service.dart';
import '../../../../http/danmaku.dart';
@ -1237,22 +1238,24 @@ class _HeaderControlState extends State<HeaderControl> {
// ),
// fuc: () => _.screenshot(),
// ),
ComBtn(
icon: const Icon(
Icons.cast,
size: 19,
color: Colors.white,
if (GlobalDataCache.enableDlna) ...[
ComBtn(
icon: const Icon(
Icons.cast,
size: 19,
color: Colors.white,
),
fuc: () async {
showDialog<void>(
context: context,
builder: (BuildContext context) {
return LiveDlnaPage(
datasource: widget.videoDetailCtr!.videoUrl);
},
);
},
),
fuc: () async {
showDialog<void>(
context: context,
builder: (BuildContext context) {
return LiveDlnaPage(
datasource: widget.videoDetailCtr!.videoUrl);
},
);
},
),
],
if (isFullScreen.value) ...[
SizedBox(
width: 56,