opt set dm/sub settings

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-08-13 19:11:46 +08:00
parent 685852c0a4
commit 65746ae2bd
2 changed files with 202 additions and 164 deletions

View File

@@ -9,7 +9,6 @@ import 'package:PiliPlus/models_new/video/video_detail/stat.dart';
import 'package:PiliPlus/models_new/video/video_detail/subtitle.dart'; import 'package:PiliPlus/models_new/video/video_detail/subtitle.dart';
import 'package:PiliPlus/models_new/video/video_detail/ugc_season.dart'; import 'package:PiliPlus/models_new/video/video_detail/ugc_season.dart';
import 'package:PiliPlus/models_new/video/video_detail/user_garb.dart'; import 'package:PiliPlus/models_new/video/video_detail/user_garb.dart';
import 'package:PiliPlus/utils/app_scheme.dart';
class VideoDetailData { class VideoDetailData {
String? bvid; String? bvid;
@@ -56,8 +55,8 @@ class VideoDetailData {
bool? disableShowUpInfo; bool? disableShowUpInfo;
int? isStoryPlay; int? isStoryPlay;
bool? isViewSelf; bool? isViewSelf;
String? epId;
List<Staff>? staff; List<Staff>? staff;
String? redirectUrl;
bool isPageReversed = false; bool isPageReversed = false;
VideoDetailData({ VideoDetailData({
@@ -105,8 +104,8 @@ class VideoDetailData {
this.disableShowUpInfo, this.disableShowUpInfo,
this.isStoryPlay, this.isStoryPlay,
this.isViewSelf, this.isViewSelf,
this.epId,
this.staff, this.staff,
this.redirectUrl,
}); });
factory VideoDetailData.fromJson(Map<String, dynamic> json) => factory VideoDetailData.fromJson(Map<String, dynamic> json) =>
@@ -178,10 +177,6 @@ class VideoDetailData {
staff: (json["staff"] as List?) staff: (json["staff"] as List?)
?.map((item) => Staff.fromJson(item)) ?.map((item) => Staff.fromJson(item))
.toList(), .toList(),
epId: json['redirect_url'] == null redirectUrl: json['redirect_url'],
? null
: PiliScheme.uriDigitRegExp
.firstMatch(json['redirect_url'])
?.group(1),
); );
} }

View File

@@ -81,7 +81,7 @@ class HeaderControlState extends TripleState<HeaderControl> {
late final horizontalScreen = videoDetailCtr.horizontalScreen; late final horizontalScreen = videoDetailCtr.horizontalScreen;
RxString now = ''.obs; RxString now = ''.obs;
Timer? clock; Timer? clock;
bool get isFullScreen => widget.controller.isFullScreen.value; bool get isFullScreen => plPlayerController.isFullScreen.value;
Box setting = GStorage.setting; Box setting = GStorage.setting;
@override @override
@@ -202,7 +202,7 @@ class HeaderControlState extends TripleState<HeaderControl> {
Builder( Builder(
builder: (context) => PopupMenuButton( builder: (context) => PopupMenuButton(
initialValue: initialValue:
widget.controller.superResolutionType.value, plPlayerController.superResolutionType.value,
child: Padding( child: Padding(
padding: const EdgeInsets.all(4), padding: const EdgeInsets.all(4),
child: Row( child: Row(
@@ -235,7 +235,7 @@ class HeaderControlState extends TripleState<HeaderControl> {
), ),
), ),
onSelected: (value) { onSelected: (value) {
widget.controller.setShader(value); plPlayerController.setShader(value);
if (context.mounted) { if (context.mounted) {
(context as Element).markNeedsBuild(); (context as Element).markNeedsBuild();
} }
@@ -292,10 +292,11 @@ class HeaderControlState extends TripleState<HeaderControl> {
children: [ children: [
Obx( Obx(
() { () {
final flipX = widget.controller.flipX.value; final flipX = plPlayerController.flipX.value;
return ActionRowLineItem( return ActionRowLineItem(
iconData: Icons.flip, iconData: Icons.flip,
onTap: () => widget.controller.flipX.value = !flipX, onTap: () =>
plPlayerController.flipX.value = !flipX,
text: " 左右翻转 ", text: " 左右翻转 ",
selectStatus: flipX, selectStatus: flipX,
); );
@@ -303,7 +304,7 @@ class HeaderControlState extends TripleState<HeaderControl> {
), ),
Obx( Obx(
() { () {
final flipY = widget.controller.flipY.value; final flipY = plPlayerController.flipY.value;
return ActionRowLineItem( return ActionRowLineItem(
icon: Transform.rotate( icon: Transform.rotate(
angle: pi / 2, angle: pi / 2,
@@ -316,7 +317,7 @@ class HeaderControlState extends TripleState<HeaderControl> {
), ),
), ),
onTap: () { onTap: () {
widget.controller.flipY.value = !flipY; plPlayerController.flipY.value = !flipY;
}, },
text: " 上下翻转 ", text: " 上下翻转 ",
selectStatus: flipY, selectStatus: flipY,
@@ -326,11 +327,11 @@ class HeaderControlState extends TripleState<HeaderControl> {
Obx( Obx(
() { () {
final onlyPlayAudio = final onlyPlayAudio =
widget.controller.onlyPlayAudio.value; plPlayerController.onlyPlayAudio.value;
return ActionRowLineItem( return ActionRowLineItem(
iconData: Icons.headphones, iconData: Icons.headphones,
onTap: () { onTap: () {
widget.controller.onlyPlayAudio.value = plPlayerController.onlyPlayAudio.value =
!onlyPlayAudio; !onlyPlayAudio;
widget.videoDetailCtr.playerInit(); widget.videoDetailCtr.playerInit();
}, },
@@ -342,10 +343,10 @@ class HeaderControlState extends TripleState<HeaderControl> {
Obx( Obx(
() => ActionRowLineItem( () => ActionRowLineItem(
iconData: Icons.play_circle_outline, iconData: Icons.play_circle_outline,
onTap: widget.controller.setContinuePlayInBackground, onTap: plPlayerController.setContinuePlayInBackground,
text: " 后台播放 ", text: " 后台播放 ",
selectStatus: selectStatus:
widget.controller.continuePlayInBackground.value, plPlayerController.continuePlayInBackground.value,
), ),
), ),
], ],
@@ -400,7 +401,7 @@ class HeaderControlState extends TripleState<HeaderControl> {
leading: const Icon(Icons.repeat, size: 20), leading: const Icon(Icons.repeat, size: 20),
title: const Text('播放顺序', style: titleStyle), title: const Text('播放顺序', style: titleStyle),
subtitle: Text( subtitle: Text(
widget.controller.playRepeat.desc, plPlayerController.playRepeat.desc,
style: subTitleStyle, style: subTitleStyle,
), ),
), ),
@@ -437,7 +438,7 @@ class HeaderControlState extends TripleState<HeaderControl> {
title: const Text('播放信息', style: titleStyle), title: const Text('播放信息', style: titleStyle),
leading: const Icon(Icons.info_outline, size: 20), leading: const Icon(Icons.info_outline, size: 20),
onTap: () { onTap: () {
Player? player = widget.controller.videoPlayerController; Player? player = plPlayerController.videoPlayerController;
if (player == null) { if (player == null) {
SmartDialog.showToast('播放器未初始化'); SmartDialog.showToast('播放器未初始化');
return; return;
@@ -934,13 +935,13 @@ class HeaderControlState extends TripleState<HeaderControl> {
/// 字幕设置 /// 字幕设置
void showSetSubtitle() { void showSetSubtitle() {
double subtitleFontScale = widget.controller.subtitleFontScale; double subtitleFontScale = plPlayerController.subtitleFontScale;
double subtitleFontScaleFS = widget.controller.subtitleFontScaleFS; double subtitleFontScaleFS = plPlayerController.subtitleFontScaleFS;
int subtitlePaddingH = widget.controller.subtitlePaddingH; int subtitlePaddingH = plPlayerController.subtitlePaddingH;
int subtitlePaddingB = widget.controller.subtitlePaddingB; int subtitlePaddingB = plPlayerController.subtitlePaddingB;
double subtitleBgOpaticy = widget.controller.subtitleBgOpaticy; double subtitleBgOpaticy = plPlayerController.subtitleBgOpaticy;
double subtitleStrokeWidth = widget.controller.subtitleStrokeWidth; double subtitleStrokeWidth = plPlayerController.subtitleStrokeWidth;
int subtitleFontWeight = widget.controller.subtitleFontWeight; int subtitleFontWeight = plPlayerController.subtitleFontWeight;
showBottomSheet( showBottomSheet(
padding: isFullScreen ? 70 : null, padding: isFullScreen ? 70 : null,
@@ -956,66 +957,80 @@ class HeaderControlState extends TripleState<HeaderControl> {
thumbShape: const RoundSliderThumbShape(enabledThumbRadius: 6.0), thumbShape: const RoundSliderThumbShape(enabledThumbRadius: 6.0),
); );
void updateStrokeWidth(double val) { void updateStrokeWidth(double val, {bool isEnd = true}) {
subtitleStrokeWidth = val; subtitleStrokeWidth = val;
widget.controller plPlayerController
..subtitleStrokeWidth = subtitleStrokeWidth ..subtitleStrokeWidth = subtitleStrokeWidth
..updateSubtitleStyle() ..updateSubtitleStyle();
..putSubtitleSettings(); if (isEnd) {
plPlayerController.putSubtitleSettings();
}
setState(() {}); setState(() {});
} }
void updateOpacity(double val) { void updateOpacity(double val, {bool isEnd = true}) {
subtitleBgOpaticy = val; subtitleBgOpaticy = val.toPrecision(2);
widget.controller plPlayerController
..subtitleBgOpaticy = subtitleBgOpaticy ..subtitleBgOpaticy = subtitleBgOpaticy
..updateSubtitleStyle() ..updateSubtitleStyle();
..putSubtitleSettings(); if (isEnd) {
plPlayerController.putSubtitleSettings();
}
setState(() {}); setState(() {});
} }
void updateBottomPadding(int val) { void updateBottomPadding(double val, {bool isEnd = true}) {
subtitlePaddingB = val; subtitlePaddingB = val.round();
widget.controller plPlayerController
..subtitlePaddingB = subtitlePaddingB ..subtitlePaddingB = subtitlePaddingB
..updateSubtitleStyle() ..updateSubtitleStyle();
..putSubtitleSettings(); if (isEnd) {
plPlayerController.putSubtitleSettings();
}
setState(() {}); setState(() {});
} }
void updateHorizontalPadding(int val) { void updateHorizontalPadding(double val, {bool isEnd = true}) {
subtitlePaddingH = val; subtitlePaddingH = val.round();
widget.controller plPlayerController
..subtitlePaddingH = subtitlePaddingH ..subtitlePaddingH = subtitlePaddingH
..updateSubtitleStyle() ..updateSubtitleStyle();
..putSubtitleSettings(); if (isEnd) {
plPlayerController.putSubtitleSettings();
}
setState(() {}); setState(() {});
} }
void updateFontScaleFS(double val) { void updateFontScaleFS(double val, {bool isEnd = true}) {
subtitleFontScaleFS = val; subtitleFontScaleFS = val;
widget.controller plPlayerController
..subtitleFontScaleFS = subtitleFontScaleFS ..subtitleFontScaleFS = subtitleFontScaleFS
..updateSubtitleStyle() ..updateSubtitleStyle();
..putSubtitleSettings(); if (isEnd) {
plPlayerController.putSubtitleSettings();
}
setState(() {}); setState(() {});
} }
void updateFontScale(double val) { void updateFontScale(double val, {bool isEnd = true}) {
subtitleFontScale = val; subtitleFontScale = val;
widget.controller plPlayerController
..subtitleFontScale = subtitleFontScale ..subtitleFontScale = subtitleFontScale
..updateSubtitleStyle() ..updateSubtitleStyle();
..putSubtitleSettings(); if (isEnd) {
plPlayerController.putSubtitleSettings();
}
setState(() {}); setState(() {});
} }
void updateFontWeight(int val) { void updateFontWeight(double val, {bool isEnd = true}) {
subtitleFontWeight = val; subtitleFontWeight = val.toInt();
widget.controller plPlayerController
..subtitleFontWeight = subtitleFontWeight ..subtitleFontWeight = subtitleFontWeight
..updateSubtitleStyle() ..updateSubtitleStyle();
..putSubtitleSettings(); if (isEnd) {
plPlayerController.putSubtitleSettings();
}
setState(() {}); setState(() {});
} }
@@ -1060,7 +1075,8 @@ class HeaderControlState extends TripleState<HeaderControl> {
divisions: 20, divisions: 20,
label: label:
'${(subtitleFontScale * 100).toStringAsFixed(1)}%', '${(subtitleFontScale * 100).toStringAsFixed(1)}%',
onChanged: updateFontScale, onChanged: (val) => updateFontScale(val, isEnd: false),
onChangeEnd: updateFontScale,
), ),
), ),
), ),
@@ -1089,7 +1105,9 @@ class HeaderControlState extends TripleState<HeaderControl> {
divisions: 20, divisions: 20,
label: label:
'${(subtitleFontScaleFS * 100).toStringAsFixed(1)}%', '${(subtitleFontScaleFS * 100).toStringAsFixed(1)}%',
onChanged: updateFontScaleFS, onChanged: (val) =>
updateFontScaleFS(val, isEnd: false),
onChangeEnd: updateFontScaleFS,
), ),
), ),
), ),
@@ -1115,9 +1133,8 @@ class HeaderControlState extends TripleState<HeaderControl> {
value: subtitleFontWeight.toDouble(), value: subtitleFontWeight.toDouble(),
divisions: 8, divisions: 8,
label: '${subtitleFontWeight + 1}', label: '${subtitleFontWeight + 1}',
onChanged: (double val) { onChanged: (val) => updateFontWeight(val, isEnd: false),
updateFontWeight(val.toInt()); onChangeEnd: updateFontWeight,
},
), ),
), ),
), ),
@@ -1143,7 +1160,9 @@ class HeaderControlState extends TripleState<HeaderControl> {
value: subtitleStrokeWidth, value: subtitleStrokeWidth,
divisions: 10, divisions: 10,
label: '$subtitleStrokeWidth', label: '$subtitleStrokeWidth',
onChanged: updateStrokeWidth, onChanged: (val) =>
updateStrokeWidth(val, isEnd: false),
onChangeEnd: updateStrokeWidth,
), ),
), ),
), ),
@@ -1169,9 +1188,9 @@ class HeaderControlState extends TripleState<HeaderControl> {
value: subtitlePaddingH.toDouble(), value: subtitlePaddingH.toDouble(),
divisions: 100, divisions: 100,
label: '$subtitlePaddingH', label: '$subtitlePaddingH',
onChanged: (double val) { onChanged: (val) =>
updateHorizontalPadding(val.round()); updateHorizontalPadding(val, isEnd: false),
}, onChangeEnd: updateHorizontalPadding,
), ),
), ),
), ),
@@ -1197,9 +1216,9 @@ class HeaderControlState extends TripleState<HeaderControl> {
value: subtitlePaddingB.toDouble(), value: subtitlePaddingB.toDouble(),
divisions: 200, divisions: 200,
label: '$subtitlePaddingB', label: '$subtitlePaddingB',
onChanged: (double val) { onChanged: (val) =>
updateBottomPadding(val.round()); updateBottomPadding(val, isEnd: false),
}, onChangeEnd: updateBottomPadding,
), ),
), ),
), ),
@@ -1223,9 +1242,8 @@ class HeaderControlState extends TripleState<HeaderControl> {
min: 0, min: 0,
max: 1, max: 1,
value: subtitleBgOpaticy, value: subtitleBgOpaticy,
onChanged: (double val) { onChanged: (val) => updateOpacity(val, isEnd: false),
updateOpacity(val.toPrecision(2)); onChangeEnd: updateOpacity,
},
), ),
), ),
), ),
@@ -1260,29 +1278,29 @@ class HeaderControlState extends TripleState<HeaderControl> {
(value: 4, label: '底部'), (value: 4, label: '底部'),
(value: 6, label: '彩色'), (value: 6, label: '彩色'),
]; ];
final blockTypes = widget.controller.blockTypes; final blockTypes = plPlayerController.blockTypes;
// 智能云屏蔽 // 智能云屏蔽
int danmakuWeight = widget.controller.danmakuWeight; int danmakuWeight = plPlayerController.danmakuWeight;
// 显示区域 // 显示区域
double showArea = widget.controller.showArea; double showArea = plPlayerController.showArea;
// 不透明度 // 不透明度
double opacity = widget.controller.danmakuOpacity; double opacity = plPlayerController.danmakuOpacity;
// 字体大小 // 字体大小
double fontSize = widget.controller.danmakuFontScale; double fontSize = plPlayerController.danmakuFontScale;
// 全屏字体大小 // 全屏字体大小
double fontSizeFS = widget.controller.danmakuFontScaleFS; double fontSizeFS = plPlayerController.danmakuFontScaleFS;
double danmakuLineHeight = widget.controller.danmakuLineHeight; double danmakuLineHeight = plPlayerController.danmakuLineHeight;
// 弹幕速度 // 弹幕速度
double danmakuDuration = widget.controller.danmakuDuration; double danmakuDuration = plPlayerController.danmakuDuration;
double danmakuStaticDuration = widget.controller.danmakuStaticDuration; double danmakuStaticDuration = plPlayerController.danmakuStaticDuration;
// 弹幕描边 // 弹幕描边
double strokeWidth = widget.controller.strokeWidth; double strokeWidth = plPlayerController.strokeWidth;
// 字体粗细 // 字体粗细
int fontWeight = widget.controller.fontWeight; int fontWeight = plPlayerController.fontWeight;
bool massiveMode = widget.controller.massiveMode; bool massiveMode = plPlayerController.massiveMode;
final DanmakuController? danmakuController = final DanmakuController? danmakuController =
widget.controller.danmakuController; plPlayerController.danmakuController;
showBottomSheet( showBottomSheet(
(context, setState) { (context, setState) {
@@ -1297,11 +1315,13 @@ class HeaderControlState extends TripleState<HeaderControl> {
thumbShape: const RoundSliderThumbShape(enabledThumbRadius: 6.0), thumbShape: const RoundSliderThumbShape(enabledThumbRadius: 6.0),
); );
void updateLineHeight(double val) { void updateLineHeight(double val, {bool isEnd = true}) {
danmakuLineHeight = val; danmakuLineHeight = val.toPrecision(1);
widget.controller if (isEnd) {
..danmakuLineHeight = danmakuLineHeight plPlayerController
..putDanmakuSettings(); ..danmakuLineHeight = danmakuLineHeight
..putDanmakuSettings();
}
setState(() {}); setState(() {});
try { try {
danmakuController?.updateOption( danmakuController?.updateOption(
@@ -1312,42 +1332,48 @@ class HeaderControlState extends TripleState<HeaderControl> {
} catch (_) {} } catch (_) {}
} }
void updateDuration(double val) { void updateDuration(double val, {bool isEnd = true}) {
danmakuDuration = val; danmakuDuration = val.toPrecision(1);
widget.controller if (isEnd) {
..danmakuDuration = danmakuDuration plPlayerController
..putDanmakuSettings(); ..danmakuDuration = danmakuDuration
..putDanmakuSettings();
}
setState(() {}); setState(() {});
try { try {
danmakuController?.updateOption( danmakuController?.updateOption(
danmakuController.option.copyWith( danmakuController.option.copyWith(
duration: danmakuDuration / widget.controller.playbackSpeed, duration: danmakuDuration / plPlayerController.playbackSpeed,
), ),
); );
} catch (_) {} } catch (_) {}
} }
void updateStaticDuration(double val) { void updateStaticDuration(double val, {bool isEnd = true}) {
danmakuStaticDuration = val; danmakuStaticDuration = val.toPrecision(1);
widget.controller if (isEnd) {
..danmakuStaticDuration = danmakuStaticDuration plPlayerController
..putDanmakuSettings(); ..danmakuStaticDuration = danmakuStaticDuration
..putDanmakuSettings();
}
setState(() {}); setState(() {});
try { try {
danmakuController?.updateOption( danmakuController?.updateOption(
danmakuController.option.copyWith( danmakuController.option.copyWith(
staticDuration: staticDuration:
danmakuStaticDuration / widget.controller.playbackSpeed, danmakuStaticDuration / plPlayerController.playbackSpeed,
), ),
); );
} catch (_) {} } catch (_) {}
} }
void updateFontSizeFS(double val) { void updateFontSizeFS(double val, {bool isEnd = true}) {
fontSizeFS = val; fontSizeFS = val;
widget.controller if (isEnd) {
..danmakuFontScaleFS = fontSizeFS plPlayerController
..putDanmakuSettings(); ..danmakuFontScaleFS = fontSizeFS
..putDanmakuSettings();
}
setState(() {}); setState(() {});
if (isFullScreen) { if (isFullScreen) {
try { try {
@@ -1360,11 +1386,13 @@ class HeaderControlState extends TripleState<HeaderControl> {
} }
} }
void updateFontSize(double val) { void updateFontSize(double val, {bool isEnd = true}) {
fontSize = val; fontSize = val;
widget.controller if (isEnd) {
..danmakuFontScale = fontSize plPlayerController
..putDanmakuSettings(); ..danmakuFontScale = fontSize
..putDanmakuSettings();
}
setState(() {}); setState(() {});
if (!isFullScreen) { if (!isFullScreen) {
try { try {
@@ -1377,11 +1405,13 @@ class HeaderControlState extends TripleState<HeaderControl> {
} }
} }
void updateStrokeWidth(double val) { void updateStrokeWidth(double val, {bool isEnd = true}) {
strokeWidth = val; strokeWidth = val;
widget.controller if (isEnd) {
..strokeWidth = val plPlayerController
..putDanmakuSettings(); ..strokeWidth = val
..putDanmakuSettings();
}
setState(() {}); setState(() {});
try { try {
danmakuController?.updateOption( danmakuController?.updateOption(
@@ -1390,11 +1420,13 @@ class HeaderControlState extends TripleState<HeaderControl> {
} catch (_) {} } catch (_) {}
} }
void updateFontWeight(int val) { void updateFontWeight(double val, {bool isEnd = true}) {
fontWeight = val; fontWeight = val.toInt();
widget.controller if (isEnd) {
..fontWeight = fontWeight plPlayerController
..putDanmakuSettings(); ..fontWeight = fontWeight
..putDanmakuSettings();
}
setState(() {}); setState(() {});
try { try {
danmakuController?.updateOption( danmakuController?.updateOption(
@@ -1403,11 +1435,13 @@ class HeaderControlState extends TripleState<HeaderControl> {
} catch (_) {} } catch (_) {}
} }
void updateOpacity(double val) { void updateOpacity(double val, {bool isEnd = true}) {
opacity = val; opacity = val;
widget.controller if (isEnd) {
..danmakuOpacity = opacity plPlayerController
..putDanmakuSettings(); ..danmakuOpacity = opacity
..putDanmakuSettings();
}
setState(() {}); setState(() {});
try { try {
danmakuController?.updateOption( danmakuController?.updateOption(
@@ -1416,11 +1450,13 @@ class HeaderControlState extends TripleState<HeaderControl> {
} catch (_) {} } catch (_) {}
} }
void updateShowArea(double val) { void updateShowArea(double val, {bool isEnd = true}) {
showArea = val; showArea = val.toPrecision(1);
widget.controller if (isEnd) {
..showArea = showArea plPlayerController
..putDanmakuSettings(); ..showArea = showArea
..putDanmakuSettings();
}
setState(() {}); setState(() {});
try { try {
danmakuController?.updateOption( danmakuController?.updateOption(
@@ -1429,6 +1465,16 @@ class HeaderControlState extends TripleState<HeaderControl> {
} catch (_) {} } catch (_) {}
} }
void updateDanmakuWeight(double val, {bool isEnd = true}) {
danmakuWeight = val.toInt();
if (isEnd) {
plPlayerController
..danmakuWeight = danmakuWeight
..putDanmakuSettings();
}
setState(() {});
}
return Padding( return Padding(
padding: const EdgeInsets.all(12), padding: const EdgeInsets.all(12),
child: Material( child: Material(
@@ -1459,7 +1505,7 @@ class HeaderControlState extends TripleState<HeaderControl> {
..back() ..back()
..toNamed( ..toNamed(
'/danmakuBlock', '/danmakuBlock',
arguments: widget.controller, arguments: plPlayerController,
), ),
child: Text( child: Text(
"屏蔽管理(${plPlayerController.filters.count})", "屏蔽管理(${plPlayerController.filters.count})",
@@ -1482,13 +1528,9 @@ class HeaderControlState extends TripleState<HeaderControl> {
value: danmakuWeight.toDouble(), value: danmakuWeight.toDouble(),
divisions: 10, divisions: 10,
label: '$danmakuWeight', label: '$danmakuWeight',
onChanged: (double val) { onChanged: (val) =>
danmakuWeight = val.toInt(); updateDanmakuWeight(val, isEnd: false),
widget.controller onChangeEnd: updateDanmakuWeight,
..danmakuWeight = danmakuWeight
..putDanmakuSettings();
setState(() {});
},
), ),
), ),
), ),
@@ -1506,7 +1548,7 @@ class HeaderControlState extends TripleState<HeaderControl> {
} else { } else {
blockTypes.add(value); blockTypes.add(value);
} }
widget.controller plPlayerController
..blockTypes = blockTypes ..blockTypes = blockTypes
..putDanmakuSettings(); ..putDanmakuSettings();
setState(() {}); setState(() {});
@@ -1537,7 +1579,7 @@ class HeaderControlState extends TripleState<HeaderControl> {
setKey: SettingBoxKey.danmakuMassiveMode, setKey: SettingBoxKey.danmakuMassiveMode,
onChanged: (value) { onChanged: (value) {
massiveMode = value; massiveMode = value;
widget.controller.massiveMode = value; plPlayerController.massiveMode = value;
setState(() {}); setState(() {});
try { try {
danmakuController?.updateOption( danmakuController?.updateOption(
@@ -1568,9 +1610,8 @@ class HeaderControlState extends TripleState<HeaderControl> {
value: showArea, value: showArea,
divisions: 9, divisions: 9,
label: '${showArea * 100}%', label: '${showArea * 100}%',
onChanged: (val) => updateShowArea( onChanged: (val) => updateShowArea(val, isEnd: false),
val.toPrecision(1), onChangeEnd: updateShowArea,
),
), ),
), ),
), ),
@@ -1596,7 +1637,8 @@ class HeaderControlState extends TripleState<HeaderControl> {
value: opacity, value: opacity,
divisions: 10, divisions: 10,
label: '${opacity * 100}%', label: '${opacity * 100}%',
onChanged: updateOpacity, onChanged: (val) => updateOpacity(val, isEnd: false),
onChangeEnd: updateOpacity,
), ),
), ),
), ),
@@ -1622,9 +1664,8 @@ class HeaderControlState extends TripleState<HeaderControl> {
value: fontWeight.toDouble(), value: fontWeight.toDouble(),
divisions: 8, divisions: 8,
label: '${fontWeight + 1}', label: '${fontWeight + 1}',
onChanged: (double val) { onChanged: (val) => updateFontWeight(val, isEnd: false),
updateFontWeight(val.toInt()); onChangeEnd: updateFontWeight,
},
), ),
), ),
), ),
@@ -1650,7 +1691,9 @@ class HeaderControlState extends TripleState<HeaderControl> {
value: strokeWidth, value: strokeWidth,
divisions: 6, divisions: 6,
label: '$strokeWidth', label: '$strokeWidth',
onChanged: updateStrokeWidth, onChanged: (val) =>
updateStrokeWidth(val, isEnd: false),
onChangeEnd: updateStrokeWidth,
), ),
), ),
), ),
@@ -1676,7 +1719,8 @@ class HeaderControlState extends TripleState<HeaderControl> {
value: fontSize, value: fontSize,
divisions: 20, divisions: 20,
label: '${(fontSize * 100).toStringAsFixed(1)}%', label: '${(fontSize * 100).toStringAsFixed(1)}%',
onChanged: updateFontSize, onChanged: (val) => updateFontSize(val, isEnd: false),
onChangeEnd: updateFontSize,
), ),
), ),
), ),
@@ -1702,7 +1746,8 @@ class HeaderControlState extends TripleState<HeaderControl> {
value: fontSizeFS, value: fontSizeFS,
divisions: 20, divisions: 20,
label: '${(fontSizeFS * 100).toStringAsFixed(1)}%', label: '${(fontSizeFS * 100).toStringAsFixed(1)}%',
onChanged: updateFontSizeFS, onChanged: (val) => updateFontSizeFS(val, isEnd: false),
onChangeEnd: updateFontSizeFS,
), ),
), ),
), ),
@@ -1728,9 +1773,8 @@ class HeaderControlState extends TripleState<HeaderControl> {
value: danmakuDuration, value: danmakuDuration,
divisions: 49, divisions: 49,
label: danmakuDuration.toString(), label: danmakuDuration.toString(),
onChanged: (double val) { onChanged: (val) => updateDuration(val, isEnd: false),
updateDuration(val.toPrecision(1)); onChangeEnd: updateDuration,
},
), ),
), ),
), ),
@@ -1756,9 +1800,9 @@ class HeaderControlState extends TripleState<HeaderControl> {
value: danmakuStaticDuration, value: danmakuStaticDuration,
divisions: 49, divisions: 49,
label: danmakuStaticDuration.toString(), label: danmakuStaticDuration.toString(),
onChanged: (double val) { onChanged: (val) =>
updateStaticDuration(val.toPrecision(1)); updateStaticDuration(val, isEnd: false),
}, onChangeEnd: updateStaticDuration,
), ),
), ),
), ),
@@ -1782,9 +1826,8 @@ class HeaderControlState extends TripleState<HeaderControl> {
min: 1.0, min: 1.0,
max: 3.0, max: 3.0,
value: danmakuLineHeight, value: danmakuLineHeight,
onChanged: (double val) { onChanged: (val) => updateLineHeight(val, isEnd: false),
updateLineHeight(val.toPrecision(1)); onChangeEnd: updateLineHeight,
},
), ),
), ),
), ),
@@ -1821,12 +1864,12 @@ class HeaderControlState extends TripleState<HeaderControl> {
ListTile( ListTile(
dense: true, dense: true,
onTap: () { onTap: () {
widget.controller.setPlayRepeat(i); plPlayerController.setPlayRepeat(i);
Get.back(); Get.back();
}, },
contentPadding: const EdgeInsets.only(left: 20, right: 20), contentPadding: const EdgeInsets.only(left: 20, right: 20),
title: Text(i.desc), title: Text(i.desc),
trailing: widget.controller.playRepeat == i trailing: plPlayerController.playRepeat == i
? Icon( ? Icon(
Icons.done, Icons.done,
color: theme.colorScheme.primary, color: theme.colorScheme.primary,
@@ -1880,7 +1923,7 @@ class HeaderControlState extends TripleState<HeaderControl> {
), ),
onPressed: () { onPressed: () {
if (isFullScreen) { if (isFullScreen) {
widget.controller.triggerFullScreen(status: false); plPlayerController.triggerFullScreen(status: false);
} else if (!horizontalScreen && !isPortrait) { } else if (!horizontalScreen && !isPortrait) {
verticalScreenForTwoSeconds(); verticalScreenForTwoSeconds();
} else { } else {
@@ -2127,7 +2170,7 @@ class HeaderControlState extends TripleState<HeaderControl> {
), ),
onPressed: () async { onPressed: () async {
bool canUsePiP = await Floating().isPipAvailable; bool canUsePiP = await Floating().isPipAvailable;
widget.controller.hiddenControls(false); plPlayerController.hiddenControls(false);
if (canUsePiP) { if (canUsePiP) {
if (!videoPlayerServiceHandler.enableBackgroundPlay && if (!videoPlayerServiceHandler.enableBackgroundPlay &&
mounted) { mounted) {