feat: custom subtitle bg stroke

Closes #90

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-01-03 11:17:57 +08:00
parent 1232116d22
commit 168bb22670
4 changed files with 55 additions and 4 deletions

View File

@@ -260,12 +260,18 @@ class PlPlayerController {
late int subtitlePaddingH = GStorage.subtitlePaddingH;
late int subtitlePaddingB = GStorage.subtitlePaddingB;
late double subtitleBgOpaticy = GStorage.subtitleBgOpaticy;
late double subtitleBgStroke = GStorage.subtitleBgStroke;
// 播放顺序相关
PlayRepeat playRepeat = PlayRepeat.pause;
final GlobalKey<VideoState> key = GlobalKey<VideoState>();
Paint get subtitleBg => Paint()
..style = PaintingStyle.stroke
..strokeWidth = subtitleBgStroke
..color = Colors.black;
TextStyle get subTitleStyle => TextStyle(
height: 1.5,
fontSize:
@@ -274,7 +280,11 @@ class PlPlayerController {
wordSpacing: 0.1,
color: Colors.white,
fontWeight: FontWeight.normal,
backgroundColor: Colors.black.withOpacity(subtitleBgOpaticy),
background:
subtitleBgOpaticy == 0 && subtitleBgStroke != 0 ? subtitleBg : null,
backgroundColor: subtitleBgOpaticy == 0
? null
: Colors.black.withOpacity(subtitleBgOpaticy),
);
SubtitleViewConfiguration get subtitleViewConfiguration =>
@@ -1340,6 +1350,7 @@ class PlPlayerController {
setting.put(SettingBoxKey.subtitlePaddingH, subtitlePaddingH);
setting.put(SettingBoxKey.subtitlePaddingB, subtitlePaddingB);
setting.put(SettingBoxKey.subtitleBgOpaticy, subtitleBgOpaticy);
setting.put(SettingBoxKey.subtitleBgStroke, subtitleBgStroke);
}
Future<void> dispose({String type = 'single'}) async {