feat: 新增弹幕描边粗细设置,默认值降低
This commit is contained in:
@ -35,6 +35,7 @@ class _PlDanmakuState extends State<PlDanmaku> {
|
||||
late double opacityVal;
|
||||
late double fontSizeVal;
|
||||
late double danmakuDurationVal;
|
||||
late double strokeWidth;
|
||||
int latestAddedPosition = -1;
|
||||
|
||||
@override
|
||||
@ -65,6 +66,7 @@ class _PlDanmakuState extends State<PlDanmaku> {
|
||||
showArea = playerController.showArea;
|
||||
opacityVal = playerController.opacityVal;
|
||||
fontSizeVal = playerController.fontSizeVal;
|
||||
strokeWidth = playerController.strokeWidth;
|
||||
danmakuDurationVal = playerController.danmakuDurationVal;
|
||||
}
|
||||
|
||||
@ -136,6 +138,7 @@ class _PlDanmakuState extends State<PlDanmaku> {
|
||||
hideBottom: blockTypes.contains(4),
|
||||
duration:
|
||||
danmakuDurationVal / playerController.playbackSpeed,
|
||||
strokeWidth: strokeWidth,
|
||||
// initDuration /
|
||||
// (danmakuSpeedVal * widget.playerController.playbackSpeed),
|
||||
),
|
||||
|
@ -1,4 +1,5 @@
|
||||
import 'dart:io';
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:floating/floating.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@ -724,6 +725,8 @@ class _HeaderControlState extends State<HeaderControl> {
|
||||
double fontSizeVal = widget.controller!.fontSizeVal;
|
||||
// 弹幕速度
|
||||
double danmakuDurationVal = widget.controller!.danmakuDurationVal;
|
||||
// 弹幕描边
|
||||
double strokeWidth = widget.controller!.strokeWidth;
|
||||
|
||||
final DanmakuController danmakuController =
|
||||
widget.controller!.danmakuController!;
|
||||
@ -857,6 +860,44 @@ class _HeaderControlState extends State<HeaderControl> {
|
||||
),
|
||||
),
|
||||
),
|
||||
Text('描边粗细 $strokeWidth'),
|
||||
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: 3,
|
||||
value: strokeWidth,
|
||||
divisions: 6,
|
||||
label: '$strokeWidth',
|
||||
onChanged: (double val) {
|
||||
strokeWidth = val;
|
||||
widget.controller!.strokeWidth = val;
|
||||
setState(() {});
|
||||
try {
|
||||
final DanmakuOption currentOption =
|
||||
danmakuController.option;
|
||||
final DanmakuOption updatedOption =
|
||||
currentOption.copyWith(strokeWidth: val);
|
||||
danmakuController.updateOption(updatedOption);
|
||||
} catch (_) {}
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
Text('字体大小 ${(fontSizeVal * 100).toStringAsFixed(1)}%'),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
|
@ -221,6 +221,7 @@ class PlPlayerController {
|
||||
late double showArea;
|
||||
late double opacityVal;
|
||||
late double fontSizeVal;
|
||||
late double strokeWidth;
|
||||
late double danmakuDurationVal;
|
||||
late List<double> speedsList;
|
||||
// 缓存
|
||||
@ -275,6 +276,9 @@ class PlPlayerController {
|
||||
// 弹幕时间
|
||||
danmakuDurationVal =
|
||||
localCache.get(LocalCacheKey.danmakuDuration, defaultValue: 4.0);
|
||||
// 描边粗细
|
||||
strokeWidth =
|
||||
localCache.get(LocalCacheKey.strokeWidth, defaultValue: 1.5);
|
||||
playRepeat = PlayRepeat.values.toList().firstWhere(
|
||||
(e) =>
|
||||
e.value ==
|
||||
@ -1086,6 +1090,7 @@ class PlPlayerController {
|
||||
localCache.put(LocalCacheKey.danmakuOpacity, opacityVal);
|
||||
localCache.put(LocalCacheKey.danmakuFontScale, fontSizeVal);
|
||||
localCache.put(LocalCacheKey.danmakuDuration, danmakuDurationVal);
|
||||
localCache.put(LocalCacheKey.strokeWidth, strokeWidth);
|
||||
if (_videoPlayerController != null) {
|
||||
var pp = _videoPlayerController!.platform as NativePlayer;
|
||||
await pp.setProperty('audio-files', '');
|
||||
|
@ -158,12 +158,13 @@ class LocalCacheKey {
|
||||
wbiKeys = 'wbiKeys',
|
||||
timeStamp = 'timeStamp',
|
||||
|
||||
// 弹幕相关设置 屏蔽类型 显示区域 透明度 字体大小 弹幕时间
|
||||
// 弹幕相关设置 屏蔽类型 显示区域 透明度 字体大小 弹幕时间 描边粗细
|
||||
danmakuBlockType = 'danmakuBlockType',
|
||||
danmakuShowArea = 'danmakuShowArea',
|
||||
danmakuOpacity = 'danmakuOpacity',
|
||||
danmakuFontScale = 'danmakuFontScale',
|
||||
danmakuDuration = 'danmakuDuration',
|
||||
strokeWidth = 'strokeWidth',
|
||||
|
||||
// 代理host port
|
||||
systemProxyHost = 'systemProxyHost',
|
||||
|
Reference in New Issue
Block a user