mod: 弹幕时长采用下凸函数调整,兼顾微调与更大范围

This commit is contained in:
orz12
2024-01-25 11:52:37 +08:00
parent 5f299d9232
commit 1393e02b1a

View File

@@ -342,8 +342,7 @@ class _HeaderControlState extends State<HeaderControl> {
}, },
dense: true, dense: true,
contentPadding: const EdgeInsets.only(), contentPadding: const EdgeInsets.only(),
title: title: const Text("额外等待视频播放完毕", style: titleStyle),
const Text("额外等待视频播放完毕", style: titleStyle),
trailing: Switch( trailing: Switch(
// thumb color (round icon) // thumb color (round icon)
activeColor: Theme.of(context).colorScheme.primary, activeColor: Theme.of(context).colorScheme.primary,
@@ -891,7 +890,7 @@ class _HeaderControlState extends State<HeaderControl> {
final DanmakuOption currentOption = final DanmakuOption currentOption =
danmakuController.option; danmakuController.option;
final DanmakuOption updatedOption = final DanmakuOption updatedOption =
currentOption.copyWith(strokeWidth: val); currentOption.copyWith(strokeWidth: val);
danmakuController.updateOption(updatedOption); danmakuController.updateOption(updatedOption);
} catch (_) {} } catch (_) {}
}, },
@@ -938,7 +937,7 @@ class _HeaderControlState extends State<HeaderControl> {
), ),
), ),
), ),
Text('弹幕时长 ${danmakuDurationVal.toString()}'), Text('弹幕时长 $danmakuDurationVal'),
Padding( Padding(
padding: const EdgeInsets.only( padding: const EdgeInsets.only(
top: 0, top: 0,
@@ -956,21 +955,21 @@ class _HeaderControlState extends State<HeaderControl> {
enabledThumbRadius: 6.0), enabledThumbRadius: 6.0),
), ),
child: Slider( child: Slider(
min: 2, min: 1,
max: 16, max: 6,
value: danmakuDurationVal, value: sqrt(danmakuDurationVal),
divisions: 28, divisions: 50,
label: danmakuDurationVal.toString(), label: danmakuDurationVal.toString(),
onChanged: (double val) { onChanged: (double val) {
danmakuDurationVal = val; danmakuDurationVal = (val * val).toPrecision(2);
widget.controller!.danmakuDurationVal = widget.controller!.danmakuDurationVal =
danmakuDurationVal; danmakuDurationVal;
setState(() {}); setState(() {});
try { try {
final DanmakuOption updatedOption = final DanmakuOption updatedOption =
danmakuController.option.copyWith( danmakuController.option.copyWith(
duration: duration: danmakuDurationVal /
val / widget.controller!.playbackSpeed); widget.controller!.playbackSpeed);
danmakuController.updateOption(updatedOption); danmakuController.updateOption(updatedOption);
} catch (_) {} } catch (_) {}
}, },
@@ -1004,7 +1003,7 @@ class _HeaderControlState extends State<HeaderControl> {
margin: const EdgeInsets.all(12), margin: const EdgeInsets.all(12),
child: Column( child: Column(
children: [ children: [
SizedBox( const SizedBox(
height: 45, height: 45,
child: Center(child: Text('选择播放顺序', style: titleStyle))), child: Center(child: Text('选择播放顺序', style: titleStyle))),
Expanded( Expanded(