feat: dlna switch

This commit is contained in:
guozhigq
2024-11-20 22:45:25 +08:00
parent 9ca47dfda4
commit 1ac152bb49
4 changed files with 29 additions and 16 deletions

View File

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

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,

View File

@ -53,6 +53,8 @@ class GlobalDataCache {
static late bool enableAutoExpand;
// 动态切换
static late bool enableDynamicSwitch;
// 投屏开关
static bool enableDlna = false;
// 私有构造函数
GlobalDataCache._();
@ -120,5 +122,6 @@ class GlobalDataCache {
setting.get(SettingBoxKey.enableAutoExpand, defaultValue: false);
enableDynamicSwitch =
setting.get(SettingBoxKey.enableDynamicSwitch, defaultValue: true);
enableDlna = setting.get(SettingBoxKey.enableDlna, defaultValue: false);
}
}

View File

@ -115,7 +115,8 @@ class SettingBoxKey {
enableAi = 'enableAi',
enableAutoExpand = 'enableAutoExpand',
defaultHomePage = 'defaultHomePage',
enableRelatedVideo = 'enableRelatedVideo';
enableRelatedVideo = 'enableRelatedVideo',
enableDlna = 'enableDlna';
/// 外观
static const String themeMode = 'themeMode',