Skip to content

Commit

Permalink
mod: 弹幕时长采用下凸函数调整,兼顾微调与更大范围
Browse files Browse the repository at this point in the history
  • Loading branch information
orz12 committed Jan 25, 2024
1 parent 5f299d9 commit 1393e02
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions lib/pages/video/detail/widgets/header_control.dart
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,7 @@ class _HeaderControlState extends State<HeaderControl> {
},
dense: true,
contentPadding: const EdgeInsets.only(),
title:
const Text("额外等待视频播放完毕", style: titleStyle),
title: const Text("额外等待视频播放完毕", style: titleStyle),
trailing: Switch(
// thumb color (round icon)
activeColor: Theme.of(context).colorScheme.primary,
Expand Down Expand Up @@ -891,7 +890,7 @@ class _HeaderControlState extends State<HeaderControl> {
final DanmakuOption currentOption =
danmakuController.option;
final DanmakuOption updatedOption =
currentOption.copyWith(strokeWidth: val);
currentOption.copyWith(strokeWidth: val);
danmakuController.updateOption(updatedOption);
} catch (_) {}
},
Expand Down Expand Up @@ -938,7 +937,7 @@ class _HeaderControlState extends State<HeaderControl> {
),
),
),
Text('弹幕时长 ${danmakuDurationVal.toString()} 秒'),
Text('弹幕时长 $danmakuDurationVal 秒'),
Padding(
padding: const EdgeInsets.only(
top: 0,
Expand All @@ -956,21 +955,21 @@ class _HeaderControlState extends State<HeaderControl> {
enabledThumbRadius: 6.0),
),
child: Slider(
min: 2,
max: 16,
value: danmakuDurationVal,
divisions: 28,
min: 1,
max: 6,
value: sqrt(danmakuDurationVal),
divisions: 50,
label: danmakuDurationVal.toString(),
onChanged: (double val) {
danmakuDurationVal = val;
danmakuDurationVal = (val * val).toPrecision(2);
widget.controller!.danmakuDurationVal =
danmakuDurationVal;
setState(() {});
try {
final DanmakuOption updatedOption =
danmakuController.option.copyWith(
duration:
val / widget.controller!.playbackSpeed);
duration: danmakuDurationVal /
widget.controller!.playbackSpeed);
danmakuController.updateOption(updatedOption);
} catch (_) {}
},
Expand Down Expand Up @@ -1004,7 +1003,7 @@ class _HeaderControlState extends State<HeaderControl> {
margin: const EdgeInsets.all(12),
child: Column(
children: [
SizedBox(
const SizedBox(
height: 45,
child: Center(child: Text('选择播放顺序', style: titleStyle))),
Expanded(
Expand Down

0 comments on commit 1393e02

Please sign in to comment.