mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
feat: subtitle stroke
Closes #446 Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -1042,6 +1042,7 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
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;
|
double subtitleBgOpaticy = widget.controller.subtitleBgOpaticy;
|
||||||
|
double subtitleStrokeWidth = widget.controller.subtitleStrokeWidth;
|
||||||
|
|
||||||
final sliderTheme = SliderThemeData(
|
final sliderTheme = SliderThemeData(
|
||||||
trackShape: MSliderTrackShape(),
|
trackShape: MSliderTrackShape(),
|
||||||
@@ -1057,6 +1058,15 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
padding: isFullScreen ? 70 : null,
|
padding: isFullScreen ? 70 : null,
|
||||||
child: StatefulBuilder(
|
child: StatefulBuilder(
|
||||||
builder: (_, setState) {
|
builder: (_, setState) {
|
||||||
|
void updateStrokeWidth(double val) {
|
||||||
|
subtitleStrokeWidth = val;
|
||||||
|
widget.controller
|
||||||
|
..subtitleStrokeWidth = subtitleStrokeWidth
|
||||||
|
..updateSubtitleStyle()
|
||||||
|
..putDanmakuSettings();
|
||||||
|
setState(() {});
|
||||||
|
}
|
||||||
|
|
||||||
void updateOpacity(double val) {
|
void updateOpacity(double val) {
|
||||||
subtitleBgOpaticy = val;
|
subtitleBgOpaticy = val;
|
||||||
widget.controller
|
widget.controller
|
||||||
@@ -1178,6 +1188,32 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text('描边粗细 $subtitleStrokeWidth'),
|
||||||
|
resetBtn(1.5, () => updateStrokeWidth(1.5)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
top: 0,
|
||||||
|
bottom: 6,
|
||||||
|
left: 10,
|
||||||
|
right: 10,
|
||||||
|
),
|
||||||
|
child: SliderTheme(
|
||||||
|
data: sliderTheme,
|
||||||
|
child: Slider(
|
||||||
|
min: 0,
|
||||||
|
max: 3,
|
||||||
|
value: subtitleStrokeWidth,
|
||||||
|
divisions: 6,
|
||||||
|
label: '$subtitleStrokeWidth',
|
||||||
|
onChanged: updateStrokeWidth,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
|
|||||||
@@ -290,6 +290,7 @@ class PlPlayerController {
|
|||||||
late int subtitlePaddingB = GStorage.subtitlePaddingB;
|
late int subtitlePaddingB = GStorage.subtitlePaddingB;
|
||||||
late double subtitleBgOpaticy = GStorage.subtitleBgOpaticy;
|
late double subtitleBgOpaticy = GStorage.subtitleBgOpaticy;
|
||||||
late bool showVipDanmaku = GStorage.showVipDanmaku;
|
late bool showVipDanmaku = GStorage.showVipDanmaku;
|
||||||
|
late double subtitleStrokeWidth = GStorage.subtitleStrokeWidth;
|
||||||
|
|
||||||
// 播放顺序相关
|
// 播放顺序相关
|
||||||
PlayRepeat playRepeat = PlayRepeat.pause;
|
PlayRepeat playRepeat = PlayRepeat.pause;
|
||||||
@@ -313,7 +314,8 @@ class PlPlayerController {
|
|||||||
right: subtitlePaddingH.toDouble(),
|
right: subtitlePaddingH.toDouble(),
|
||||||
bottom: subtitlePaddingB.toDouble(),
|
bottom: subtitlePaddingB.toDouble(),
|
||||||
),
|
),
|
||||||
textScaleFactor: MediaQuery.textScalerOf(Get.context!).scale(1),
|
textScaleFactor: 1,
|
||||||
|
strokeWidth: subtitleBgOpaticy == 0 ? subtitleStrokeWidth : null,
|
||||||
);
|
);
|
||||||
|
|
||||||
GlobalKey<VideoState> Function()? getPlayerKey;
|
GlobalKey<VideoState> Function()? getPlayerKey;
|
||||||
@@ -1533,6 +1535,7 @@ class PlPlayerController {
|
|||||||
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);
|
setting.put(SettingBoxKey.subtitleBgOpaticy, subtitleBgOpaticy);
|
||||||
|
setting.put(SettingBoxKey.subtitleStrokeWidth, subtitleStrokeWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> dispose({String type = 'single'}) async {
|
Future<void> dispose({String type = 'single'}) async {
|
||||||
|
|||||||
@@ -307,6 +307,9 @@ class GStorage {
|
|||||||
static double get subtitleBgOpaticy =>
|
static double get subtitleBgOpaticy =>
|
||||||
setting.get(SettingBoxKey.subtitleBgOpaticy, defaultValue: 0.67);
|
setting.get(SettingBoxKey.subtitleBgOpaticy, defaultValue: 0.67);
|
||||||
|
|
||||||
|
static double get subtitleStrokeWidth =>
|
||||||
|
setting.get(SettingBoxKey.subtitleStrokeWidth, defaultValue: 1.5);
|
||||||
|
|
||||||
static bool get badCertificateCallback =>
|
static bool get badCertificateCallback =>
|
||||||
setting.get(SettingBoxKey.badCertificateCallback, defaultValue: false);
|
setting.get(SettingBoxKey.badCertificateCallback, defaultValue: false);
|
||||||
|
|
||||||
@@ -630,6 +633,7 @@ class SettingBoxKey {
|
|||||||
subtitlePaddingH = 'subtitlePaddingH',
|
subtitlePaddingH = 'subtitlePaddingH',
|
||||||
subtitlePaddingB = 'subtitlePaddingB',
|
subtitlePaddingB = 'subtitlePaddingB',
|
||||||
subtitleBgOpaticy = 'subtitleBgOpaticy',
|
subtitleBgOpaticy = 'subtitleBgOpaticy',
|
||||||
|
subtitleStrokeWidth = 'subtitleStrokeWidth',
|
||||||
badCertificateCallback = 'badCertificateCallback',
|
badCertificateCallback = 'badCertificateCallback',
|
||||||
continuePlayingPart = 'continuePlayingPart',
|
continuePlayingPart = 'continuePlayingPart',
|
||||||
cdnSpeedTest = 'cdnSpeedTest',
|
cdnSpeedTest = 'cdnSpeedTest',
|
||||||
|
|||||||
@@ -1210,10 +1210,11 @@ packages:
|
|||||||
media_kit_video:
|
media_kit_video:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: media_kit_video
|
path: media_kit_video
|
||||||
sha256: "2cc3b966679963ba25a4ce5b771e532a521ebde7c6aa20e9802bec95d9916c8f"
|
ref: "version_1.2.5"
|
||||||
url: "https://pub.dev"
|
resolved-ref: cb6fd7e49c30433140001cd19e4e9a8e03c14249
|
||||||
source: hosted
|
url: "https://github.com/bggRGjQaUbCoE/media-kit.git"
|
||||||
|
source: git
|
||||||
version: "1.2.5"
|
version: "1.2.5"
|
||||||
meta:
|
meta:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
|
|||||||
@@ -102,7 +102,12 @@ dependencies:
|
|||||||
|
|
||||||
# 视频播放器
|
# 视频播放器
|
||||||
media_kit: ^1.1.11 # Primary package.
|
media_kit: ^1.1.11 # Primary package.
|
||||||
media_kit_video: ^1.2.5 # For video rendering.
|
# media_kit_video: ^1.2.5 # For video rendering.
|
||||||
|
media_kit_video:
|
||||||
|
git:
|
||||||
|
url: https://github.com/bggRGjQaUbCoE/media-kit.git
|
||||||
|
path: media_kit_video
|
||||||
|
ref: version_1.2.5
|
||||||
media_kit_libs_video: ^1.0.5
|
media_kit_libs_video: ^1.0.5
|
||||||
|
|
||||||
# 媒体通知
|
# 媒体通知
|
||||||
|
|||||||
Reference in New Issue
Block a user