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, setKey: SettingBoxKey.enableQuickDouble,
defaultVal: true, defaultVal: true,
), ),
SettingsModel(
settingsType: SettingsType.sw1tch,
title: '左右侧滑动调节亮度/音量',
leading: Icon(MdiIcons.tuneVerticalVariant),
setKey: SettingBoxKey.enableSlideVolumeBrightness,
defaultVal: true,
),
SettingsModel( SettingsModel(
settingsType: SettingsType.normal, settingsType: SettingsType.normal,
title: '自动启用字幕', title: '自动启用字幕',

View File

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

View File

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

View File

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