mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-08-02 16:50:13 +08:00
@@ -5,6 +5,7 @@ import 'package:PiliPlus/grpc/bilibili/community/service/dm/v1.pb.dart';
|
|||||||
import 'package:PiliPlus/grpc/dm.dart';
|
import 'package:PiliPlus/grpc/dm.dart';
|
||||||
import 'package:PiliPlus/http/loading_state.dart';
|
import 'package:PiliPlus/http/loading_state.dart';
|
||||||
import 'package:PiliPlus/plugin/pl_player/controller.dart';
|
import 'package:PiliPlus/plugin/pl_player/controller.dart';
|
||||||
|
import 'package:PiliPlus/plugin/pl_player/utils/danmaku_options.dart';
|
||||||
import 'package:PiliPlus/utils/accounts.dart';
|
import 'package:PiliPlus/utils/accounts.dart';
|
||||||
import 'package:PiliPlus/utils/path_utils.dart';
|
import 'package:PiliPlus/utils/path_utils.dart';
|
||||||
import 'package:PiliPlus/utils/utils.dart';
|
import 'package:PiliPlus/utils/utils.dart';
|
||||||
@@ -67,7 +68,7 @@ class PlDanmakuController {
|
|||||||
final uniques = HashMap<String, DanmakuElem>();
|
final uniques = HashMap<String, DanmakuElem>();
|
||||||
|
|
||||||
final shouldFilter = _plPlayerController.filters.count != 0;
|
final shouldFilter = _plPlayerController.filters.count != 0;
|
||||||
final danmakuWeight = _plPlayerController.danmakuWeight;
|
final danmakuWeight = DanmakuOptions.danmakuWeight;
|
||||||
for (final element in elems) {
|
for (final element in elems) {
|
||||||
if (_isLogin) {
|
if (_isLogin) {
|
||||||
element.isSelf = element.midHash == _plPlayerController.midHash;
|
element.isSelf = element.midHash == _plPlayerController.midHash;
|
||||||
|
|||||||
@@ -1289,16 +1289,16 @@ class HeaderControlState extends State<HeaderControl>
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double get subtitleFontScale => plPlayerController.subtitleFontScale;
|
||||||
|
double get subtitleFontScaleFS => plPlayerController.subtitleFontScaleFS;
|
||||||
|
int get subtitlePaddingH => plPlayerController.subtitlePaddingH;
|
||||||
|
int get subtitlePaddingB => plPlayerController.subtitlePaddingB;
|
||||||
|
double get subtitleBgOpacity => plPlayerController.subtitleBgOpacity;
|
||||||
|
double get subtitleStrokeWidth => plPlayerController.subtitleStrokeWidth;
|
||||||
|
int get subtitleFontWeight => plPlayerController.subtitleFontWeight;
|
||||||
|
|
||||||
/// 字幕设置
|
/// 字幕设置
|
||||||
void showSetSubtitle() {
|
void showSetSubtitle() {
|
||||||
double subtitleFontScale = plPlayerController.subtitleFontScale;
|
|
||||||
double subtitleFontScaleFS = plPlayerController.subtitleFontScaleFS;
|
|
||||||
int subtitlePaddingH = plPlayerController.subtitlePaddingH;
|
|
||||||
int subtitlePaddingB = plPlayerController.subtitlePaddingB;
|
|
||||||
double subtitleBgOpacity = plPlayerController.subtitleBgOpacity;
|
|
||||||
double subtitleStrokeWidth = plPlayerController.subtitleStrokeWidth;
|
|
||||||
int subtitleFontWeight = plPlayerController.subtitleFontWeight;
|
|
||||||
|
|
||||||
showBottomSheet(
|
showBottomSheet(
|
||||||
padding: isFullScreen ? 70 : null,
|
padding: isFullScreen ? 70 : null,
|
||||||
(context, setState) {
|
(context, setState) {
|
||||||
@@ -1314,57 +1314,50 @@ class HeaderControlState extends State<HeaderControl>
|
|||||||
);
|
);
|
||||||
|
|
||||||
void updateStrokeWidth(double val) {
|
void updateStrokeWidth(double val) {
|
||||||
subtitleStrokeWidth = val;
|
|
||||||
plPlayerController
|
plPlayerController
|
||||||
..subtitleStrokeWidth = subtitleStrokeWidth
|
..subtitleStrokeWidth = val
|
||||||
..updateSubtitleStyle();
|
..updateSubtitleStyle();
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateOpacity(double val) {
|
void updateOpacity(double val) {
|
||||||
subtitleBgOpacity = val.toPrecision(2);
|
|
||||||
plPlayerController
|
plPlayerController
|
||||||
..subtitleBgOpacity = subtitleBgOpacity
|
..subtitleBgOpacity = val.toPrecision(2)
|
||||||
..updateSubtitleStyle();
|
..updateSubtitleStyle();
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateBottomPadding(double val) {
|
void updateBottomPadding(double val) {
|
||||||
subtitlePaddingB = val.round();
|
|
||||||
plPlayerController
|
plPlayerController
|
||||||
..subtitlePaddingB = subtitlePaddingB
|
..subtitlePaddingB = val.round()
|
||||||
..updateSubtitleStyle();
|
..updateSubtitleStyle();
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateHorizontalPadding(double val) {
|
void updateHorizontalPadding(double val) {
|
||||||
subtitlePaddingH = val.round();
|
|
||||||
plPlayerController
|
plPlayerController
|
||||||
..subtitlePaddingH = subtitlePaddingH
|
..subtitlePaddingH = val.round()
|
||||||
..updateSubtitleStyle();
|
..updateSubtitleStyle();
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateFontScaleFS(double val) {
|
void updateFontScaleFS(double val) {
|
||||||
subtitleFontScaleFS = val;
|
|
||||||
plPlayerController
|
plPlayerController
|
||||||
..subtitleFontScaleFS = subtitleFontScaleFS
|
..subtitleFontScaleFS = val
|
||||||
..updateSubtitleStyle();
|
..updateSubtitleStyle();
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateFontScale(double val) {
|
void updateFontScale(double val) {
|
||||||
subtitleFontScale = val;
|
|
||||||
plPlayerController
|
plPlayerController
|
||||||
..subtitleFontScale = subtitleFontScale
|
..subtitleFontScale = val
|
||||||
..updateSubtitleStyle();
|
..updateSubtitleStyle();
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateFontWeight(double val) {
|
void updateFontWeight(double val) {
|
||||||
subtitleFontWeight = val.toInt();
|
|
||||||
plPlayerController
|
plPlayerController
|
||||||
..subtitleFontWeight = subtitleFontWeight
|
..subtitleFontWeight = val.toInt()
|
||||||
..updateSubtitleStyle();
|
..updateSubtitleStyle();
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}
|
}
|
||||||
@@ -1391,12 +1384,7 @@ class HeaderControlState extends State<HeaderControl>
|
|||||||
Text(
|
Text(
|
||||||
'字体大小 ${(subtitleFontScale * 100).toStringAsFixed(1)}%',
|
'字体大小 ${(subtitleFontScale * 100).toStringAsFixed(1)}%',
|
||||||
),
|
),
|
||||||
resetBtn(
|
resetBtn(theme, '100.0%', () => updateFontScale(1.0)),
|
||||||
theme,
|
|
||||||
'100.0%',
|
|
||||||
() => updateFontScale(1.0),
|
|
||||||
isDanmaku: false,
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
@@ -1416,8 +1404,6 @@ class HeaderControlState extends State<HeaderControl>
|
|||||||
label:
|
label:
|
||||||
'${(subtitleFontScale * 100).toStringAsFixed(1)}%',
|
'${(subtitleFontScale * 100).toStringAsFixed(1)}%',
|
||||||
onChanged: updateFontScale,
|
onChanged: updateFontScale,
|
||||||
onChangeEnd: (_) =>
|
|
||||||
plPlayerController.putSubtitleSettings(),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -1427,12 +1413,7 @@ class HeaderControlState extends State<HeaderControl>
|
|||||||
Text(
|
Text(
|
||||||
'全屏字体大小 ${(subtitleFontScaleFS * 100).toStringAsFixed(1)}%',
|
'全屏字体大小 ${(subtitleFontScaleFS * 100).toStringAsFixed(1)}%',
|
||||||
),
|
),
|
||||||
resetBtn(
|
resetBtn(theme, '150.0%', () => updateFontScaleFS(1.5)),
|
||||||
theme,
|
|
||||||
'150.0%',
|
|
||||||
() => updateFontScaleFS(1.5),
|
|
||||||
isDanmaku: false,
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
@@ -1452,8 +1433,6 @@ class HeaderControlState extends State<HeaderControl>
|
|||||||
label:
|
label:
|
||||||
'${(subtitleFontScaleFS * 100).toStringAsFixed(1)}%',
|
'${(subtitleFontScaleFS * 100).toStringAsFixed(1)}%',
|
||||||
onChanged: updateFontScaleFS,
|
onChanged: updateFontScaleFS,
|
||||||
onChangeEnd: (_) =>
|
|
||||||
plPlayerController.putSubtitleSettings,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -1461,12 +1440,7 @@ class HeaderControlState extends State<HeaderControl>
|
|||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
Text('字体粗细 ${subtitleFontWeight + 1}(可能无法精确调节)'),
|
Text('字体粗细 ${subtitleFontWeight + 1}(可能无法精确调节)'),
|
||||||
resetBtn(
|
resetBtn(theme, 6, () => updateFontWeight(5)),
|
||||||
theme,
|
|
||||||
6,
|
|
||||||
() => updateFontWeight(5),
|
|
||||||
isDanmaku: false,
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
@@ -1485,8 +1459,6 @@ class HeaderControlState extends State<HeaderControl>
|
|||||||
divisions: 8,
|
divisions: 8,
|
||||||
label: '${subtitleFontWeight + 1}',
|
label: '${subtitleFontWeight + 1}',
|
||||||
onChanged: updateFontWeight,
|
onChanged: updateFontWeight,
|
||||||
onChangeEnd: (_) =>
|
|
||||||
plPlayerController.putSubtitleSettings(),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -1494,12 +1466,7 @@ class HeaderControlState extends State<HeaderControl>
|
|||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
Text('描边粗细 $subtitleStrokeWidth'),
|
Text('描边粗细 $subtitleStrokeWidth'),
|
||||||
resetBtn(
|
resetBtn(theme, 2.0, () => updateStrokeWidth(2.0)),
|
||||||
theme,
|
|
||||||
2.0,
|
|
||||||
() => updateStrokeWidth(2.0),
|
|
||||||
isDanmaku: false,
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
@@ -1518,8 +1485,6 @@ class HeaderControlState extends State<HeaderControl>
|
|||||||
divisions: 10,
|
divisions: 10,
|
||||||
label: '$subtitleStrokeWidth',
|
label: '$subtitleStrokeWidth',
|
||||||
onChanged: updateStrokeWidth,
|
onChanged: updateStrokeWidth,
|
||||||
onChangeEnd: (_) =>
|
|
||||||
plPlayerController.putSubtitleSettings(),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -1527,12 +1492,7 @@ class HeaderControlState extends State<HeaderControl>
|
|||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
Text('左右边距 $subtitlePaddingH'),
|
Text('左右边距 $subtitlePaddingH'),
|
||||||
resetBtn(
|
resetBtn(theme, 24, () => updateHorizontalPadding(24)),
|
||||||
theme,
|
|
||||||
24,
|
|
||||||
() => updateHorizontalPadding(24),
|
|
||||||
isDanmaku: false,
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
@@ -1551,8 +1511,6 @@ class HeaderControlState extends State<HeaderControl>
|
|||||||
divisions: 100,
|
divisions: 100,
|
||||||
label: '$subtitlePaddingH',
|
label: '$subtitlePaddingH',
|
||||||
onChanged: updateHorizontalPadding,
|
onChanged: updateHorizontalPadding,
|
||||||
onChangeEnd: (_) =>
|
|
||||||
plPlayerController.putSubtitleSettings(),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -1560,12 +1518,7 @@ class HeaderControlState extends State<HeaderControl>
|
|||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
Text('底部边距 $subtitlePaddingB'),
|
Text('底部边距 $subtitlePaddingB'),
|
||||||
resetBtn(
|
resetBtn(theme, 24, () => updateBottomPadding(24)),
|
||||||
theme,
|
|
||||||
24,
|
|
||||||
() => updateBottomPadding(24),
|
|
||||||
isDanmaku: false,
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
@@ -1584,8 +1537,6 @@ class HeaderControlState extends State<HeaderControl>
|
|||||||
divisions: 200,
|
divisions: 200,
|
||||||
label: '$subtitlePaddingB',
|
label: '$subtitlePaddingB',
|
||||||
onChanged: updateBottomPadding,
|
onChanged: updateBottomPadding,
|
||||||
onChangeEnd: (_) =>
|
|
||||||
plPlayerController.putSubtitleSettings(),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -1593,12 +1544,7 @@ class HeaderControlState extends State<HeaderControl>
|
|||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
Text('背景不透明度 ${(subtitleBgOpacity * 100).toInt()}%'),
|
Text('背景不透明度 ${(subtitleBgOpacity * 100).toInt()}%'),
|
||||||
resetBtn(
|
resetBtn(theme, '67%', () => updateOpacity(0.67)),
|
||||||
theme,
|
|
||||||
'67%',
|
|
||||||
() => updateOpacity(0.67),
|
|
||||||
isDanmaku: false,
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
@@ -1615,8 +1561,6 @@ class HeaderControlState extends State<HeaderControl>
|
|||||||
max: 1,
|
max: 1,
|
||||||
value: subtitleBgOpacity,
|
value: subtitleBgOpacity,
|
||||||
onChanged: updateOpacity,
|
onChanged: updateOpacity,
|
||||||
onChangeEnd: (_) =>
|
|
||||||
plPlayerController.putSubtitleSettings(),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -1626,7 +1570,7 @@ class HeaderControlState extends State<HeaderControl>
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
)?.whenComplete(plPlayerController.putSubtitleSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
void showDanmakuPool() {
|
void showDanmakuPool() {
|
||||||
|
|||||||
@@ -4,8 +4,6 @@ import 'package:PiliPlus/plugin/pl_player/controller.dart';
|
|||||||
import 'package:PiliPlus/plugin/pl_player/utils/danmaku_options.dart';
|
import 'package:PiliPlus/plugin/pl_player/utils/danmaku_options.dart';
|
||||||
import 'package:PiliPlus/utils/extension/num_ext.dart';
|
import 'package:PiliPlus/utils/extension/num_ext.dart';
|
||||||
import 'package:PiliPlus/utils/page_utils.dart';
|
import 'package:PiliPlus/utils/page_utils.dart';
|
||||||
import 'package:PiliPlus/utils/storage.dart';
|
|
||||||
import 'package:PiliPlus/utils/storage_key.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
@@ -33,21 +31,11 @@ mixin HeaderMixin<T extends StatefulWidget> on State<T> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget resetBtn(
|
Widget resetBtn(ThemeData theme, Object def, VoidCallback onPressed) {
|
||||||
ThemeData theme,
|
|
||||||
Object def,
|
|
||||||
VoidCallback onPressed, {
|
|
||||||
bool isDanmaku = true,
|
|
||||||
}) {
|
|
||||||
return iconButton(
|
return iconButton(
|
||||||
tooltip: '默认值: $def',
|
tooltip: '默认值: $def',
|
||||||
icon: const Icon(Icons.refresh),
|
icon: const Icon(Icons.refresh),
|
||||||
onPressed: () {
|
onPressed: onPressed,
|
||||||
onPressed();
|
|
||||||
if (!isDanmaku) {
|
|
||||||
plPlayerController.putSubtitleSettings();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
iconColor: theme.colorScheme.outline,
|
iconColor: theme.colorScheme.outline,
|
||||||
size: 24,
|
size: 24,
|
||||||
iconSize: 24,
|
iconSize: 24,
|
||||||
@@ -55,7 +43,7 @@ mixin HeaderMixin<T extends StatefulWidget> on State<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// 弹幕功能
|
/// 弹幕功能
|
||||||
Future<void> showSetDanmaku({bool isLive = false}) async {
|
void showSetDanmaku({bool isLive = false}) {
|
||||||
// 屏蔽类型
|
// 屏蔽类型
|
||||||
const blockTypesList = [
|
const blockTypesList = [
|
||||||
(value: 2, label: '滚动'),
|
(value: 2, label: '滚动'),
|
||||||
@@ -69,7 +57,7 @@ mixin HeaderMixin<T extends StatefulWidget> on State<T> {
|
|||||||
|
|
||||||
final isFullScreen = this.isFullScreen;
|
final isFullScreen = this.isFullScreen;
|
||||||
|
|
||||||
await showBottomSheet(
|
showBottomSheet(
|
||||||
(context, setState) {
|
(context, setState) {
|
||||||
final theme = Theme.of(context);
|
final theme = Theme.of(context);
|
||||||
|
|
||||||
@@ -147,7 +135,7 @@ mixin HeaderMixin<T extends StatefulWidget> on State<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void updateDanmakuWeight(double val) {
|
void updateDanmakuWeight(double val) {
|
||||||
plPlayerController.danmakuWeight = val.toInt();
|
DanmakuOptions.danmakuWeight = val.toInt();
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -184,7 +172,7 @@ mixin HeaderMixin<T extends StatefulWidget> on State<T> {
|
|||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: .spaceBetween,
|
mainAxisAlignment: .spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
Text('智能云屏蔽 ${plPlayerController.danmakuWeight} 级'),
|
Text('智能云屏蔽 ${DanmakuOptions.danmakuWeight} 级'),
|
||||||
TextButton(
|
TextButton(
|
||||||
style: TextButton.styleFrom(
|
style: TextButton.styleFrom(
|
||||||
padding: EdgeInsets.zero,
|
padding: EdgeInsets.zero,
|
||||||
@@ -215,14 +203,10 @@ mixin HeaderMixin<T extends StatefulWidget> on State<T> {
|
|||||||
child: Slider(
|
child: Slider(
|
||||||
min: 0,
|
min: 0,
|
||||||
max: 10,
|
max: 10,
|
||||||
value: plPlayerController.danmakuWeight.toDouble(),
|
value: DanmakuOptions.danmakuWeight.toDouble(),
|
||||||
divisions: 10,
|
divisions: 10,
|
||||||
label: '${plPlayerController.danmakuWeight}',
|
label: DanmakuOptions.danmakuWeight.toString(),
|
||||||
onChanged: updateDanmakuWeight,
|
onChanged: updateDanmakuWeight,
|
||||||
onChangeEnd: (val) => GStorage.setting.put(
|
|
||||||
SettingBoxKey.danmakuWeight,
|
|
||||||
val.toInt(),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -255,30 +239,30 @@ mixin HeaderMixin<T extends StatefulWidget> on State<T> {
|
|||||||
spacing: 10,
|
spacing: 10,
|
||||||
children: [
|
children: [
|
||||||
ActionRowLineItem(
|
ActionRowLineItem(
|
||||||
selectStatus: DanmakuOptions.massiveMode,
|
selectStatus: DanmakuOptions.danmakuMassiveMode,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
DanmakuOptions.massiveMode =
|
DanmakuOptions.danmakuMassiveMode =
|
||||||
!DanmakuOptions.massiveMode;
|
!DanmakuOptions.danmakuMassiveMode;
|
||||||
setState(() {});
|
setState(() {});
|
||||||
setOptions();
|
setOptions();
|
||||||
},
|
},
|
||||||
text: '海量弹幕',
|
text: '海量弹幕',
|
||||||
),
|
),
|
||||||
ActionRowLineItem(
|
ActionRowLineItem(
|
||||||
selectStatus: DanmakuOptions.static2Scroll,
|
selectStatus: DanmakuOptions.danmakuStatic2Scroll,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
DanmakuOptions.static2Scroll =
|
DanmakuOptions.danmakuStatic2Scroll =
|
||||||
!DanmakuOptions.static2Scroll;
|
!DanmakuOptions.danmakuStatic2Scroll;
|
||||||
setState(() {});
|
setState(() {});
|
||||||
setOptions();
|
setOptions();
|
||||||
},
|
},
|
||||||
text: '固定转滚动',
|
text: '固定转滚动',
|
||||||
),
|
),
|
||||||
ActionRowLineItem(
|
ActionRowLineItem(
|
||||||
selectStatus: DanmakuOptions.scrollFixedVelocity,
|
selectStatus: DanmakuOptions.danmakuFixedV,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
DanmakuOptions.scrollFixedVelocity =
|
DanmakuOptions.danmakuFixedV =
|
||||||
!DanmakuOptions.scrollFixedVelocity;
|
!DanmakuOptions.danmakuFixedV;
|
||||||
setState(() {});
|
setState(() {});
|
||||||
setOptions();
|
setOptions();
|
||||||
},
|
},
|
||||||
@@ -534,9 +518,9 @@ mixin HeaderMixin<T extends StatefulWidget> on State<T> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
)?.whenComplete(
|
||||||
|
() => DanmakuOptions.save(plPlayerController.danmakuOpacity.value),
|
||||||
);
|
);
|
||||||
|
|
||||||
await DanmakuOptions.save();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import 'package:PiliPlus/plugin/pl_player/models/video_fit_type.dart';
|
|||||||
import 'package:PiliPlus/plugin/pl_player/utils/fullscreen.dart';
|
import 'package:PiliPlus/plugin/pl_player/utils/fullscreen.dart';
|
||||||
import 'package:PiliPlus/services/service_locator.dart';
|
import 'package:PiliPlus/services/service_locator.dart';
|
||||||
import 'package:PiliPlus/utils/accounts.dart';
|
import 'package:PiliPlus/utils/accounts.dart';
|
||||||
|
import 'package:PiliPlus/utils/extension/box_ext.dart';
|
||||||
import 'package:PiliPlus/utils/extension/num_ext.dart';
|
import 'package:PiliPlus/utils/extension/num_ext.dart';
|
||||||
import 'package:PiliPlus/utils/extension/string_ext.dart';
|
import 'package:PiliPlus/utils/extension/string_ext.dart';
|
||||||
import 'package:PiliPlus/utils/feed_back.dart';
|
import 'package:PiliPlus/utils/feed_back.dart';
|
||||||
@@ -323,7 +324,6 @@ class PlPlayerController {
|
|||||||
|
|
||||||
// 弹幕相关配置
|
// 弹幕相关配置
|
||||||
late final enableTapDm = PlatformUtils.isMobile && Pref.enableTapDm;
|
late final enableTapDm = PlatformUtils.isMobile && Pref.enableTapDm;
|
||||||
late int danmakuWeight = Pref.danmakuWeight;
|
|
||||||
late RuleFilter filters = Pref.danmakuFilterRule;
|
late RuleFilter filters = Pref.danmakuFilterRule;
|
||||||
// 关联弹幕控制器
|
// 关联弹幕控制器
|
||||||
DanmakuController<DanmakuExtra>? danmakuController;
|
DanmakuController<DanmakuExtra>? danmakuController;
|
||||||
@@ -1667,7 +1667,7 @@ class PlPlayerController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void putSubtitleSettings() {
|
void putSubtitleSettings() {
|
||||||
setting.putAll({
|
setting.putAllNE({
|
||||||
SettingBoxKey.subtitleFontScale: subtitleFontScale,
|
SettingBoxKey.subtitleFontScale: subtitleFontScale,
|
||||||
SettingBoxKey.subtitleFontScaleFS: subtitleFontScaleFS,
|
SettingBoxKey.subtitleFontScaleFS: subtitleFontScaleFS,
|
||||||
SettingBoxKey.subtitlePaddingH: subtitlePaddingH,
|
SettingBoxKey.subtitlePaddingH: subtitlePaddingH,
|
||||||
|
|||||||
@@ -8,19 +8,20 @@ abstract final class DanmakuOptions {
|
|||||||
static final Set<int> blockTypes = Pref.danmakuBlockType;
|
static final Set<int> blockTypes = Pref.danmakuBlockType;
|
||||||
static bool blockColorful = blockTypes.contains(6);
|
static bool blockColorful = blockTypes.contains(6);
|
||||||
|
|
||||||
|
static int danmakuWeight = Pref.danmakuWeight;
|
||||||
static double danmakuFontScaleFS = Pref.danmakuFontScaleFS;
|
static double danmakuFontScaleFS = Pref.danmakuFontScaleFS;
|
||||||
static double danmakuFontScale = Pref.danmakuFontScale;
|
static double danmakuFontScale = Pref.danmakuFontScale;
|
||||||
static int danmakuFontWeight = Pref.fontWeight;
|
static int danmakuFontWeight = Pref.danmakuFontWeight;
|
||||||
static double danmakuShowArea = Pref.danmakuShowArea;
|
static double danmakuShowArea = Pref.danmakuShowArea;
|
||||||
static double danmakuDuration = Pref.danmakuDuration;
|
static double danmakuDuration = Pref.danmakuDuration;
|
||||||
static double danmakuStaticDuration = Pref.danmakuStaticDuration;
|
static double danmakuStaticDuration = Pref.danmakuStaticDuration;
|
||||||
static double danmakuStrokeWidth = Pref.strokeWidth;
|
static double danmakuStrokeWidth = Pref.danmakuStrokeWidth;
|
||||||
static bool scrollFixedVelocity = Pref.danmakuFixedV;
|
static bool danmakuFixedV = Pref.danmakuFixedV;
|
||||||
static bool static2Scroll = Pref.static2Scroll;
|
static bool danmakuStatic2Scroll = Pref.danmakuStatic2Scroll;
|
||||||
static bool massiveMode = Pref.danmakuMassiveMode;
|
static bool danmakuMassiveMode = Pref.danmakuMassiveMode;
|
||||||
static double danmakuLineHeight = Pref.danmakuLineHeight;
|
static double danmakuLineHeight = Pref.danmakuLineHeight;
|
||||||
|
|
||||||
static bool sameFontScale = danmakuFontScale == danmakuFontScaleFS;
|
static bool get sameFontScale => danmakuFontScale == danmakuFontScaleFS;
|
||||||
|
|
||||||
static DanmakuOption get({
|
static DanmakuOption get({
|
||||||
required bool notFullscreen,
|
required bool notFullscreen,
|
||||||
@@ -37,15 +38,15 @@ abstract final class DanmakuOptions {
|
|||||||
hideTop: blockTypes.contains(5),
|
hideTop: blockTypes.contains(5),
|
||||||
hideSpecial: blockTypes.contains(7),
|
hideSpecial: blockTypes.contains(7),
|
||||||
strokeWidth: danmakuStrokeWidth,
|
strokeWidth: danmakuStrokeWidth,
|
||||||
scrollFixedVelocity: scrollFixedVelocity,
|
scrollFixedVelocity: danmakuFixedV,
|
||||||
massiveMode: massiveMode,
|
massiveMode: danmakuMassiveMode,
|
||||||
static2Scroll: static2Scroll,
|
static2Scroll: danmakuStatic2Scroll,
|
||||||
safeArea: true,
|
safeArea: true,
|
||||||
lineHeight: danmakuLineHeight,
|
lineHeight: danmakuLineHeight,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future<void>? save() {
|
static Future<void>? save(double danmakuOpacity) {
|
||||||
return GStorage.setting.putAllNE({
|
return GStorage.setting.putAllNE({
|
||||||
SettingBoxKey.danmakuBlockType: blockTypes.toList(),
|
SettingBoxKey.danmakuBlockType: blockTypes.toList(),
|
||||||
SettingBoxKey.danmakuShowArea: danmakuShowArea,
|
SettingBoxKey.danmakuShowArea: danmakuShowArea,
|
||||||
@@ -53,9 +54,14 @@ abstract final class DanmakuOptions {
|
|||||||
SettingBoxKey.danmakuFontScaleFS: danmakuFontScaleFS,
|
SettingBoxKey.danmakuFontScaleFS: danmakuFontScaleFS,
|
||||||
SettingBoxKey.danmakuDuration: danmakuDuration,
|
SettingBoxKey.danmakuDuration: danmakuDuration,
|
||||||
SettingBoxKey.danmakuStaticDuration: danmakuStaticDuration,
|
SettingBoxKey.danmakuStaticDuration: danmakuStaticDuration,
|
||||||
SettingBoxKey.strokeWidth: danmakuStrokeWidth,
|
SettingBoxKey.danmakuStrokeWidth: danmakuStrokeWidth,
|
||||||
SettingBoxKey.fontWeight: danmakuFontWeight,
|
SettingBoxKey.danmakuFontWeight: danmakuFontWeight,
|
||||||
SettingBoxKey.danmakuLineHeight: danmakuLineHeight,
|
SettingBoxKey.danmakuLineHeight: danmakuLineHeight,
|
||||||
|
SettingBoxKey.danmakuMassiveMode: danmakuMassiveMode,
|
||||||
|
SettingBoxKey.danmakuStatic2Scroll: danmakuStatic2Scroll,
|
||||||
|
SettingBoxKey.danmakuFixedV: danmakuFixedV,
|
||||||
|
SettingBoxKey.danmakuWeight: danmakuWeight,
|
||||||
|
SettingBoxKey.danmakuOpacity: danmakuOpacity,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -192,10 +192,10 @@ abstract final class SettingBoxKey {
|
|||||||
danmakuStaticDuration = 'danmakuStaticDuration',
|
danmakuStaticDuration = 'danmakuStaticDuration',
|
||||||
danmakuMassiveMode = 'danmakuMassiveMode',
|
danmakuMassiveMode = 'danmakuMassiveMode',
|
||||||
danmakuFixedV = 'danmakuFixedV',
|
danmakuFixedV = 'danmakuFixedV',
|
||||||
static2Scroll = 'static2Scroll',
|
danmakuStatic2Scroll = 'danmakuStatic2Scroll',
|
||||||
danmakuLineHeight = 'danmakuLineHeight',
|
danmakuLineHeight = 'danmakuLineHeight',
|
||||||
strokeWidth = 'strokeWidth',
|
danmakuStrokeWidth = 'strokeWidth',
|
||||||
fontWeight = 'fontWeight';
|
danmakuFontWeight = 'fontWeight';
|
||||||
|
|
||||||
static const String systemProxyHost = 'systemProxyHost',
|
static const String systemProxyHost = 'systemProxyHost',
|
||||||
systemProxyPort = 'systemProxyPort';
|
systemProxyPort = 'systemProxyPort';
|
||||||
|
|||||||
@@ -322,8 +322,8 @@ abstract final class Pref {
|
|||||||
static bool get danmakuFixedV =>
|
static bool get danmakuFixedV =>
|
||||||
_setting.get(SettingBoxKey.danmakuFixedV, defaultValue: false);
|
_setting.get(SettingBoxKey.danmakuFixedV, defaultValue: false);
|
||||||
|
|
||||||
static bool get static2Scroll =>
|
static bool get danmakuStatic2Scroll =>
|
||||||
_setting.get(SettingBoxKey.static2Scroll, defaultValue: false);
|
_setting.get(SettingBoxKey.danmakuStatic2Scroll, defaultValue: false);
|
||||||
|
|
||||||
static double get subtitleFontScale =>
|
static double get subtitleFontScale =>
|
||||||
_setting.get(SettingBoxKey.subtitleFontScale, defaultValue: 1.0);
|
_setting.get(SettingBoxKey.subtitleFontScale, defaultValue: 1.0);
|
||||||
@@ -733,11 +733,11 @@ abstract final class Pref {
|
|||||||
static double get danmakuStaticDuration =>
|
static double get danmakuStaticDuration =>
|
||||||
_setting.get(SettingBoxKey.danmakuStaticDuration, defaultValue: 4.0);
|
_setting.get(SettingBoxKey.danmakuStaticDuration, defaultValue: 4.0);
|
||||||
|
|
||||||
static double get strokeWidth =>
|
static double get danmakuStrokeWidth =>
|
||||||
_setting.get(SettingBoxKey.strokeWidth, defaultValue: 1.5);
|
_setting.get(SettingBoxKey.danmakuStrokeWidth, defaultValue: 1.5);
|
||||||
|
|
||||||
static int get fontWeight =>
|
static int get danmakuFontWeight =>
|
||||||
_setting.get(SettingBoxKey.fontWeight, defaultValue: 5);
|
_setting.get(SettingBoxKey.danmakuFontWeight, defaultValue: 5);
|
||||||
|
|
||||||
static bool get enableLongShowControl =>
|
static bool get enableLongShowControl =>
|
||||||
_setting.get(SettingBoxKey.enableLongShowControl, defaultValue: false);
|
_setting.get(SettingBoxKey.enableLongShowControl, defaultValue: false);
|
||||||
|
|||||||
Reference in New Issue
Block a user