mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
feat: custom subtitle bg opacity
Closes #78 Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -1024,6 +1024,7 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
bool massiveMode = widget.controller.massiveMode;
|
bool massiveMode = widget.controller.massiveMode;
|
||||||
int subtitlePaddingH = widget.controller.subtitlePaddingH;
|
int subtitlePaddingH = widget.controller.subtitlePaddingH;
|
||||||
int subtitlePaddingB = widget.controller.subtitlePaddingB;
|
int subtitlePaddingB = widget.controller.subtitlePaddingB;
|
||||||
|
double subtitleBgOpaticy = widget.controller.subtitleBgOpaticy;
|
||||||
|
|
||||||
final DanmakuController? danmakuController =
|
final DanmakuController? danmakuController =
|
||||||
widget.controller.danmakuController;
|
widget.controller.danmakuController;
|
||||||
@@ -1457,7 +1458,7 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
min: 1.0,
|
min: 1.0,
|
||||||
max: 3.0,
|
max: 3.0,
|
||||||
value: danmakuLineHeight,
|
value: danmakuLineHeight,
|
||||||
label: '$danmakuLineHeight',
|
// label: '$danmakuLineHeight',
|
||||||
onChanged: (double val) {
|
onChanged: (double val) {
|
||||||
danmakuLineHeight = val.toPrecision(1);
|
danmakuLineHeight = val.toPrecision(1);
|
||||||
widget.controller
|
widget.controller
|
||||||
@@ -1615,6 +1616,39 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
Text('字幕背景不透明度 ${(subtitleBgOpaticy * 100).toInt()}%'),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
top: 0,
|
||||||
|
bottom: 6,
|
||||||
|
left: 10,
|
||||||
|
right: 10,
|
||||||
|
),
|
||||||
|
child: SliderTheme(
|
||||||
|
data: SliderThemeData(
|
||||||
|
trackShape: MSliderTrackShape(),
|
||||||
|
thumbColor: Theme.of(context).colorScheme.primary,
|
||||||
|
activeTrackColor: Theme.of(context).colorScheme.primary,
|
||||||
|
trackHeight: 10,
|
||||||
|
thumbShape: const RoundSliderThumbShape(
|
||||||
|
enabledThumbRadius: 6.0),
|
||||||
|
),
|
||||||
|
child: Slider(
|
||||||
|
min: 0,
|
||||||
|
max: 1,
|
||||||
|
value: subtitleBgOpaticy,
|
||||||
|
// label: '${(subtitleBgOpaticy * 100).toInt()}%',
|
||||||
|
onChanged: (double val) {
|
||||||
|
subtitleBgOpaticy = val.toPrecision(2);
|
||||||
|
widget.controller
|
||||||
|
..subtitleBgOpaticy = subtitleBgOpaticy
|
||||||
|
..updateSubtitleStyle()
|
||||||
|
..putDanmakuSettings();
|
||||||
|
setState(() {});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -256,6 +256,7 @@ class PlPlayerController {
|
|||||||
late double danmakuLineHeight = GStorage.danmakuLineHeight;
|
late double danmakuLineHeight = GStorage.danmakuLineHeight;
|
||||||
late int subtitlePaddingH = GStorage.subtitlePaddingH;
|
late int subtitlePaddingH = GStorage.subtitlePaddingH;
|
||||||
late int subtitlePaddingB = GStorage.subtitlePaddingB;
|
late int subtitlePaddingB = GStorage.subtitlePaddingB;
|
||||||
|
late double subtitleBgOpaticy = GStorage.subtitleBgOpaticy;
|
||||||
|
|
||||||
// 播放顺序相关
|
// 播放顺序相关
|
||||||
PlayRepeat playRepeat = PlayRepeat.pause;
|
PlayRepeat playRepeat = PlayRepeat.pause;
|
||||||
@@ -270,7 +271,7 @@ class PlPlayerController {
|
|||||||
wordSpacing: 0.1,
|
wordSpacing: 0.1,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
fontWeight: FontWeight.normal,
|
fontWeight: FontWeight.normal,
|
||||||
backgroundColor: Color(0xaa000000),
|
backgroundColor: Colors.black.withOpacity(subtitleBgOpaticy),
|
||||||
);
|
);
|
||||||
|
|
||||||
void updateSubtitleStyle([double? value]) {
|
void updateSubtitleStyle([double? value]) {
|
||||||
@@ -1322,6 +1323,7 @@ class PlPlayerController {
|
|||||||
setting.put(SettingBoxKey.danmakuLineHeight, danmakuLineHeight);
|
setting.put(SettingBoxKey.danmakuLineHeight, danmakuLineHeight);
|
||||||
setting.put(SettingBoxKey.subtitlePaddingH, subtitlePaddingH);
|
setting.put(SettingBoxKey.subtitlePaddingH, subtitlePaddingH);
|
||||||
setting.put(SettingBoxKey.subtitlePaddingB, subtitlePaddingB);
|
setting.put(SettingBoxKey.subtitlePaddingB, subtitlePaddingB);
|
||||||
|
setting.put(SettingBoxKey.subtitleBgOpaticy, subtitleBgOpaticy);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> dispose({String type = 'single'}) async {
|
Future<void> dispose({String type = 'single'}) async {
|
||||||
|
|||||||
@@ -157,6 +157,9 @@ class GStorage {
|
|||||||
static int get subtitlePaddingB =>
|
static int get subtitlePaddingB =>
|
||||||
setting.get(SettingBoxKey.subtitlePaddingB, defaultValue: 24);
|
setting.get(SettingBoxKey.subtitlePaddingB, defaultValue: 24);
|
||||||
|
|
||||||
|
static double get subtitleBgOpaticy =>
|
||||||
|
setting.get(SettingBoxKey.subtitleBgOpaticy, defaultValue: 0.67);
|
||||||
|
|
||||||
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]));
|
||||||
|
|
||||||
@@ -362,6 +365,7 @@ class SettingBoxKey {
|
|||||||
reverseFromFirst = 'reverseFromFirst',
|
reverseFromFirst = 'reverseFromFirst',
|
||||||
subtitlePaddingH = 'subtitlePaddingH',
|
subtitlePaddingH = 'subtitlePaddingH',
|
||||||
subtitlePaddingB = 'subtitlePaddingB',
|
subtitlePaddingB = 'subtitlePaddingB',
|
||||||
|
subtitleBgOpaticy = 'subtitleBgOpaticy',
|
||||||
|
|
||||||
// Sponsor Block
|
// Sponsor Block
|
||||||
enableSponsorBlock = 'enableSponsorBlock',
|
enableSponsorBlock = 'enableSponsorBlock',
|
||||||
|
|||||||
Reference in New Issue
Block a user