Files
PiliPlus/lib/pages/setting/models/play_settings.dart
dom 07843a5e77 drop
Signed-off-by: dom <githubaccount56556@proton.me>
2026-05-08 21:27:01 +08:00

79 lines
2.5 KiB
Dart

import 'package:PiliPlus/common/widgets/custom_icon.dart';
import 'package:PiliPlus/pages/setting/models/model.dart';
import 'package:PiliPlus/plugin/pl_player/models/play_repeat.dart';
import 'package:PiliPlus/utils/platform_utils.dart';
import 'package:PiliPlus/utils/storage.dart';
import 'package:PiliPlus/utils/storage_key.dart';
import 'package:PiliPlus/utils/storage_pref.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
List<SettingsModel> get playSettings => [
const SwitchModel(
title: '弹幕开关',
subtitle: '是否展示弹幕',
leading: Icon(CustomIcons.dm_settings),
setKey: SettingBoxKey.enableShowDanmaku,
defaultVal: true,
),
NormalModel(
onTap: (context, setState) => Get.toNamed('/playSpeedSet'),
leading: const Icon(Icons.speed_outlined),
title: '倍速设置',
subtitle: '设置视频播放速度',
),
SwitchModel(
title: '全屏显示电池电量',
leading: const Icon(Icons.battery_3_bar),
setKey: SettingBoxKey.showBatteryLevel,
defaultVal: PlatformUtils.isMobile,
),
getVideoFilterSelectModel(
title: '双击快进/快退时长',
suffix: 's',
key: SettingBoxKey.fastForBackwardDuration,
values: [5, 10, 15],
defaultValue: 10,
isFilter: false,
),
getVideoFilterSelectModel(
title: '滑动快进/快退时长',
subtitle: '从播放器一端滑到另一端的快进/快退时长',
suffix: 's',
key: SettingBoxKey.sliderDuration,
values: [25, 50, 90, 100],
defaultValue: 90,
isFilter: false,
),
SwitchModel(
title: '启用键盘控制',
leading: const Icon(Icons.keyboard_alt_outlined),
setKey: SettingBoxKey.keyboardControl,
defaultVal: PlatformUtils.isDesktop,
),
if (PlatformUtils.isMobile)
const SwitchModel(
title: '后台播放',
subtitle: '进入后台时继续播放',
leading: Icon(Icons.motion_photos_pause_outlined),
setKey: SettingBoxKey.continuePlayInBackground,
defaultVal: false,
),
const SwitchModel(
title: '观看人数',
subtitle: '展示同时在看人数',
leading: Icon(Icons.people_outlined),
setKey: SettingBoxKey.enableOnlineTotal,
defaultVal: false,
),
PopupModel(
title: '播放顺序',
leading: const Icon(Icons.repeat),
value: () => Pref.playRepeat,
items: PlayRepeat.values,
onSelected: (value, setState) => GStorage.video
.put(VideoBoxKey.playRepeat, value.index)
.whenComplete(setState),
),
];