mod: custom enableSlideVolumeBrightness

Closes #439

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-03-14 19:47:22 +08:00
parent 21fe0ef288
commit 0ebe976b8a
4 changed files with 24 additions and 0 deletions

View File

@@ -742,6 +742,13 @@ List<SettingsModel> get playSettings => [
setKey: SettingBoxKey.enableQuickDouble,
defaultVal: true,
),
SettingsModel(
settingsType: SettingsType.sw1tch,
title: '左右侧滑动调节亮度/音量',
leading: Icon(MdiIcons.tuneVerticalVariant),
setKey: SettingBoxKey.enableSlideVolumeBrightness,
defaultVal: true,
),
SettingsModel(
settingsType: SettingsType.normal,
title: '自动启用字幕',

View File

@@ -257,6 +257,7 @@ class PlPlayerController {
late final showFSActionItem = GStorage.showFSActionItem;
late final enableShrinkVideoSize = GStorage.enableShrinkVideoSize;
late final darkVideoPage = GStorage.darkVideoPage;
late final enableSlideVolumeBrightness = GStorage.enableSlideVolumeBrightness;
/// 弹幕权重
int danmakuWeight = 0;

View File

@@ -747,12 +747,18 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
final double tapPosition = details.localFocalPoint.dx;
final double sectionWidth = totalWidth / 3;
if (tapPosition < sectionWidth) {
if (plPlayerController.enableSlideVolumeBrightness.not) {
return;
}
// 左边区域
_gestureType = 'left';
} else if (tapPosition < sectionWidth * 2) {
// 全屏
_gestureType = 'center';
} else {
if (plPlayerController.enableSlideVolumeBrightness.not) {
return;
}
// 右边区域
_gestureType = 'right';
}
@@ -1142,12 +1148,18 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
final double sectionWidth = totalWidth / 3;
late String gestureType;
if (tapPosition < sectionWidth) {
if (plPlayerController.enableSlideVolumeBrightness.not) {
return;
}
// 左边区域
gestureType = 'left';
} else if (tapPosition < sectionWidth * 2) {
// 全屏
gestureType = 'center';
} else {
if (plPlayerController.enableSlideVolumeBrightness.not) {
return;
}
// 右边区域
gestureType = 'right';
}

View File

@@ -406,6 +406,9 @@ class GStorage {
static bool get darkVideoPage =>
GStorage.setting.get(SettingBoxKey.darkVideoPage, defaultValue: false);
static bool get enableSlideVolumeBrightness => GStorage.setting
.get(SettingBoxKey.enableSlideVolumeBrightness, defaultValue: true);
static List<double> get dynamicDetailRatio => List<double>.from(setting
.get(SettingBoxKey.dynamicDetailRatio, defaultValue: [60.0, 40.0]));
@@ -665,6 +668,7 @@ class SettingBoxKey {
enableShrinkVideoSize = 'enableShrinkVideoSize',
showDynActionBar = 'showDynActionBar',
darkVideoPage = 'darkVideoPage',
enableSlideVolumeBrightness = 'enableSlideVolumeBrightness',
// Sponsor Block
enableSponsorBlock = 'enableSponsorBlock',