feat: 调整设置,支持导入导出,代码优化

This commit is contained in:
orz12
2024-04-27 02:05:50 +08:00
parent a4d3713b05
commit ea8f44f4da
41 changed files with 882 additions and 424 deletions

View File

@@ -65,30 +65,35 @@ class _PlaySettingState extends State<PlaySetting> {
const SetSwitchItem(
title: '弹幕开关',
subTitle: '是否展示弹幕',
leading: Icon(Icons.comment_outlined),
setKey: SettingBoxKey.enableShowDanmaku,
defaultVal: false,
),
ListTile(
dense: false,
onTap: () => Get.toNamed('/playSpeedSet'),
leading: const Icon(Icons.speed_outlined),
title: Text('倍速设置', style: titleStyle),
subtitle: Text('设置视频播放速度', style: subTitleStyle),
),
const SetSwitchItem(
title: '自动播放',
subTitle: '进入详情页自动播放',
leading: Icon(Icons.motion_photos_auto_outlined),
setKey: SettingBoxKey.autoPlayEnable,
defaultVal: true,
),
const SetSwitchItem(
title: '双击快退/快进',
subTitle: '左侧双击快退,右侧双击快进',
leading: Icon(Icons.touch_app_outlined),
setKey: SettingBoxKey.enableQuickDouble,
defaultVal: true,
),
ListTile(
dense: false,
title: Text('自动启用字幕', style: titleStyle),
leading: const Icon(Icons.closed_caption_outlined),
subtitle: Text(
'当前选择偏好:'
'${SubtitlePreferenceCode.fromCode(defaultSubtitlePreference)!.description}',
@@ -116,30 +121,35 @@ class _PlaySettingState extends State<PlaySetting> {
const SetSwitchItem(
title: '竖屏扩大展示',
subTitle: '小屏竖屏视频宽高比由16:9扩大至4:5暂不支持临时收起',
leading: Icon(Icons.expand_outlined),
setKey: SettingBoxKey.enableVerticalExpand,
defaultVal: false,
),
const SetSwitchItem(
title: '自动全屏',
subTitle: '视频开始播放时进入全屏',
leading: Icon(Icons.fullscreen_outlined),
setKey: SettingBoxKey.enableAutoEnter,
defaultVal: false,
),
const SetSwitchItem(
title: '自动退出全屏',
subTitle: '视频结束播放时退出全屏',
leading: Icon(Icons.fullscreen_exit_outlined),
setKey: SettingBoxKey.enableAutoExit,
defaultVal: true,
),
const SetSwitchItem(
title: '全向旋转',
subTitle: '非全屏时可受重力转为临时全屏,若系统锁定旋转仍异常触发请关闭,无异常可保持开启',
subTitle: '小屏可受重力转为临时全屏,若系统锁定旋转仍触发请关闭,关闭会影响横屏适配',
leading: Icon(Icons.screen_rotation_alt_outlined),
setKey: SettingBoxKey.allowRotateScreen,
defaultVal: true,
),
const SetSwitchItem(
title: '后台播放',
subTitle: '进入后台时继续播放',
leading: Icon(Icons.motion_photos_pause_outlined),
setKey: SettingBoxKey.continuePlayInBackground,
defaultVal: true,
),
@@ -147,6 +157,7 @@ class _PlaySettingState extends State<PlaySetting> {
SetSwitchItem(
title: '后台画中画',
subTitle: '进入后台时以小窗形式PiP播放',
leading: const Icon(Icons.picture_in_picture_outlined),
setKey: SettingBoxKey.autoPiP,
defaultVal: false,
callFn: (val) {
@@ -160,26 +171,30 @@ class _PlaySettingState extends State<PlaySetting> {
const SetSwitchItem(
title: '画中画不加载弹幕',
subTitle: '当弹幕开关开启时,小窗屏蔽弹幕以获得较好的体验',
leading: Icon(Icons.comments_disabled_outlined),
setKey: SettingBoxKey.pipNoDanmaku,
defaultVal: true,
),
const SetSwitchItem(
title: '全屏手势反向',
subTitle: '默认播放器中部向上滑动进入全屏,向下退出\n开启后向下全屏,向上退出',
leading: Icon(Icons.swap_vert_outlined),
setKey: SettingBoxKey.fullScreenGestureReverse,
defaultVal: false,
),
const SetSwitchItem(
title: '观看人数',
subTitle: '展示同时在看人数',
leading: Icon(Icons.people_outlined),
setKey: SettingBoxKey.enableOnlineTotal,
defaultVal: false,
),
ListTile(
dense: false,
title: Text('默认全屏方', style: titleStyle),
title: Text('默认全屏方', style: titleStyle),
leading: const Icon(Icons.open_with_outlined),
subtitle: Text(
'当前全屏方${FullScreenModeCode.fromCode(defaultFullScreenMode)!.description}',
'当前全屏方${FullScreenModeCode.fromCode(defaultFullScreenMode)!.description}',
style: subTitleStyle,
),
onTap: () async {
@@ -187,7 +202,7 @@ class _PlaySettingState extends State<PlaySetting> {
context: context,
builder: (context) {
return SelectDialog<int>(
title: '默认全屏方',
title: '默认全屏方',
value: defaultFullScreenMode,
values: FullScreenMode.values.map((e) {
return {'title': e.description, 'value': e.code};
@@ -204,6 +219,7 @@ class _PlaySettingState extends State<PlaySetting> {
ListTile(
dense: false,
title: Text('底部进度条展示', style: titleStyle),
leading: const Icon(Icons.border_bottom_outlined),
subtitle: Text(
'当前展示方式:${BtmProgresBehaviorCode.fromCode(defaultBtmProgressBehavior)!.description}',
style: subTitleStyle,
@@ -230,6 +246,7 @@ class _PlaySettingState extends State<PlaySetting> {
const SetSwitchItem(
title: '后台音频服务',
subTitle: '避免画中画没有播放暂停功能',
leading: Icon(Icons.volume_up_outlined),
setKey: SettingBoxKey.enableBackgroundPlay,
defaultVal: true,
),