Skip to content

基于自定义规则的番剧采集APP,支持流媒体在线观看,支持弹幕,支持实时超分辨率。

feat(ui): redesign settings slider rows

Prediditf8b42631d72b
diff --git a/lib/bean/settings/settings_list.dart b/lib/bean/settings/settings_list.dart
index b08b70cc..a027f2d3 100644
--- a/lib/bean/settings/settings_list.dart
+++ b/lib/bean/settings/settings_list.dart
@@ -188,6 +188,145 @@ class SettingsRadioSection<T> extends StatelessWidget {
}
}
+Color _disabledOn(BuildContext context) =>
+ Theme.of(context).colorScheme.onSurface.withValues(alpha: 0.38);
+
+/// The icon-and-text run every row opens with. Callers wrap it in [Expanded].
+class _TileLabel extends StatelessWidget {
+ const _TileLabel({
+ required this.title,
+ this.leading,
+ this.description,
+ this.enabled = true,
+ });
+
+ final Widget title;
+ final IconData? leading;
+ final Widget? description;
+ final bool enabled;
+
+ @override
+ Widget build(BuildContext context) {
+ final colorScheme = Theme.of(context).colorScheme;
+ final textTheme = Theme.of(context).textTheme;
+ final disabled = enabled ? null : _disabledOn(context);
+ final foreground = disabled ?? colorScheme.onSurface;
+ final secondary = disabled ?? colorScheme.onSurfaceVariant;
+
+ return Row(
+ children: [
+ if (leading != null) ...[
+ Icon(leading, size: 24, color: secondary),
+ const SizedBox(width: 16),
+ ],
+ Expanded(
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.center,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ DefaultTextStyle.merge(
+ style: textTheme.bodyLarge?.copyWith(color: foreground),
+ child: title,
+ ),
+ if (description != null) ...[
+ const SizedBox(height: 2),
+ DefaultTextStyle.merge(
+ style: textTheme.bodySmall?.copyWith(color: secondary),
+ child: description!,
+ ),
+ ],
+ ],
+ ),
+ ),
+ ],
+ );
+ }
+}
+
+/// A row whose control is a slider. The label line carries a tonal readout of
+/// the current value and the track spans the row beneath it, so the icon, the
+/// track and the text never share a line.
+class SettingsSliderTile extends StatelessWidget {
+ const SettingsSliderTile({
+ super.key,
+ required this.title,
+ required this.value,
+ required this.valueLabel,
+ required this.min,
+ required this.max,
+ required this.onChanged,
+ this.divisions,
+ this.leading,
+ this.description,
+ });
+
+ final Widget title;
+ final IconData? leading;
+ final Widget? description;
+ final String valueLabel;
+ final double value;
+ final double min;
+ final double max;
+ final int? divisions;
+ final ValueChanged<double> onChanged;
+
+ @override
+ Widget build(BuildContext context) {
+ final colorScheme = Theme.of(context).colorScheme;
+ final textTheme = Theme.of(context).textTheme;
+
+ return Padding(
+ padding: const EdgeInsets.fromLTRB(16, 12, 16, 12),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
+ Row(
+ children: [
+ Expanded(
+ child: _TileLabel(
+ title: title,
+ leading: leading,
+ description: description,
+ ),
+ ),
+ const SizedBox(width: 12),
+ Container(
+ padding:
+ const EdgeInsets.symmetric(horizontal: 10, vertical: 4),
+ decoration: BoxDecoration(
+ color: colorScheme.secondaryContainer,
+ borderRadius: BorderRadius.circular(8),
+ ),
+ child: Text(
+ valueLabel,
+ style: textTheme.labelMedium?.copyWith(
+ color: colorScheme.onSecondaryContainer,
+ // Steady digit widths, so dragging can't jitter the pill.
+ fontFeatures: const [FontFeature.tabularFigures()],
+ ),
+ ),
+ ),
+ ],
+ ),
+ const SizedBox(height: 8),
+ Slider(
+ value: value,
+ min: min,
+ max: max,
+ divisions: divisions,
+ // The pill is the readout, so no bubble rides the thumb; the zero
+ // inset then measures the track against the row rather than the
+ // thumb's overlay box.
+ showValueIndicator: ShowValueIndicator.never,
+ padding: EdgeInsets.zero,
+ onChanged: onChanged,
+ ),
+ ],
+ ),
+ );
+ }
+}
+
class SettingsTile<T> extends StatelessWidget {
const SettingsTile({
super.key,
@@ -267,9 +406,8 @@ class SettingsTile<T> extends StatelessWidget {
Widget build(BuildContext context) {
final colorScheme = Theme.of(context).colorScheme;
final textTheme = Theme.of(context).textTheme;
- final disabled = colorScheme.onSurface.withValues(alpha: 0.38);
- final foreground = enabled ? colorScheme.onSurface : disabled;
- final secondary = enabled ? colorScheme.onSurfaceVariant : disabled;
+ final secondary =
+ enabled ? colorScheme.onSurfaceVariant : _disabledOn(context);
return InkWell(
onTap: _tapHandler(context),
@@ -280,27 +418,12 @@ class SettingsTile<T> extends StatelessWidget {
constraints: const BoxConstraints(minHeight: 32),
child: Row(
children: [
- if (leading != null) ...[
- Icon(leading, size: 24, color: secondary),
- const SizedBox(width: 16),
- ],
Expanded(
- child: Column(
- mainAxisAlignment: MainAxisAlignment.center,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- DefaultTextStyle.merge(
- style: textTheme.bodyLarge?.copyWith(color: foreground),
- child: title,
- ),
- if (description != null) ...[
- const SizedBox(height: 2),
- DefaultTextStyle.merge(
- style: textTheme.bodySmall?.copyWith(color: secondary),
- child: description!,
- ),
- ],
- ],
+ child: _TileLabel(
+ title: title,
+ leading: leading,
+ description: description,
+ enabled: enabled,
),
),
if (value != null) ...[
diff --git a/lib/pages/settings/danmaku/danmaku_settings.dart b/lib/pages/settings/danmaku/danmaku_settings.dart
index e6327e6f..498b3f2f 100644
--- a/lib/pages/settings/danmaku/danmaku_settings.dart
+++ b/lib/pages/settings/danmaku/danmaku_settings.dart
@@ -220,48 +220,37 @@ class _DanmakuSettingsPageState extends State<DanmakuSettingsPage> {
SettingsSection(
title: Text('弹幕显示'),
tiles: [
- SettingsTile(
+ SettingsSliderTile(
leading: Icons.crop_free_rounded,
title: Text('弹幕区域'),
- description: Slider(
- value: defaultDanmakuArea,
- min: 0,
- max: 1,
- divisions: 8,
- label: '${(defaultDanmakuArea * 100).round()}%',
- onChanged: (value) {
- updateDanmakuArea(value);
- },
- ),
+ value: defaultDanmakuArea,
+ min: 0,
+ max: 1,
+ divisions: 8,
+ valueLabel: '${(defaultDanmakuArea * 100).round()}%',
+ onChanged: updateDanmakuArea,
),
- SettingsTile(
+ SettingsSliderTile(
leading: Icons.timer_rounded,
title: Text('弹幕持续时间'),
- description: Slider(
- value: defaultDanmakuDuration,
- min: 2,
- max: 16,
- divisions: 14,
- label: '${defaultDanmakuDuration.round()}',
- onChanged: (value) {
- updateDanmakuDuration(value.round().toDouble());
- },
- ),
+ value: defaultDanmakuDuration,
+ min: 2,
+ max: 16,
+ divisions: 14,
+ valueLabel: '${defaultDanmakuDuration.round()} 秒',
+ onChanged: (value) =>
+ updateDanmakuDuration(value.roundToDouble()),
),
- SettingsTile(
+ SettingsSliderTile(
leading: Icons.format_line_spacing_rounded,
title: Text('弹幕行高'),
- description: Slider(
- value: defaultDanmakuLineHeight,
- min: 0,
- max: 3,
- divisions: 30,
- label: defaultDanmakuLineHeight.toStringAsFixed(1),
- onChanged: (value) {
- updateDanmakuLineHeight(
- double.parse(value.toStringAsFixed(1)));
- },
- ),
+ value: defaultDanmakuLineHeight,
+ min: 0,
+ max: 3,
+ divisions: 30,
+ valueLabel: defaultDanmakuLineHeight.toStringAsFixed(1),
+ onChanged: (value) => updateDanmakuLineHeight(
+ double.parse(value.toStringAsFixed(1))),
),
SettingsTile.switchTile(
leading: Icons.speed_rounded,
@@ -349,20 +338,16 @@ class _DanmakuSettingsPageState extends State<DanmakuSettingsPage> {
title: Text('弹幕描边'),
initialValue: danmakuBorder,
),
- SettingsTile(
+ SettingsSliderTile(
leading: Icons.line_weight_rounded,
title: Text('弹幕描边粗细'),
- description: Slider(
- value: defaultdanmakuBorderSize,
- min: 0.1,
- max: 3,
- divisions: 29,
- label: defaultdanmakuBorderSize.toStringAsFixed(1),
- onChanged: (value) {
- updateDanmakuBorderSize(
- double.parse(value.toStringAsFixed(1)));
- },
- ),
+ value: defaultdanmakuBorderSize,
+ min: 0.1,
+ max: 3,
+ divisions: 29,
+ valueLabel: defaultdanmakuBorderSize.toStringAsFixed(1),
+ onChanged: (value) => updateDanmakuBorderSize(
+ double.parse(value.toStringAsFixed(1))),
),
SettingsTile.switchTile(
leading: Icons.palette_rounded,
@@ -375,46 +360,35 @@ class _DanmakuSettingsPageState extends State<DanmakuSettingsPage> {
title: Text('弹幕颜色'),
initialValue: danmakuColor,
),
- SettingsTile(
+ SettingsSliderTile(
leading: Icons.format_size_rounded,
title: Text('字体大小'),
- description: Slider(
- value: defaultDanmakuFontSize,
- min: 10,
- max: isCompact() ? 32 : 48,
- label: '${defaultDanmakuFontSize.floorToDouble()}',
- onChanged: (value) {
- updateDanmakuFontSize(value.floorToDouble());
- },
- ),
+ value: defaultDanmakuFontSize,
+ min: 10,
+ max: isCompact() ? 32 : 48,
+ valueLabel: '${defaultDanmakuFontSize.floor()}',
+ onChanged: (value) =>
+ updateDanmakuFontSize(value.floorToDouble()),
),
- SettingsTile(
+ SettingsSliderTile(
leading: Icons.format_bold_rounded,
title: Text('字体字重'),
- description: Slider(
- value: defaultDanmakuFontWeight.toDouble(),
- min: 1,
- max: 9,
- divisions: 8,
- label: '$defaultDanmakuFontWeight',
- onChanged: (value) {
- updateDanmakuFontWeight(value.toInt());
- },
- ),
+ value: defaultDanmakuFontWeight.toDouble(),
+ min: 1,
+ max: 9,
+ divisions: 8,
+ valueLabel: '$defaultDanmakuFontWeight',
+ onChanged: (value) => updateDanmakuFontWeight(value.toInt()),
),
- SettingsTile(
+ SettingsSliderTile(
leading: Icons.opacity_rounded,
title: Text('弹幕不透明度'),
- description: Slider(
- value: defaultDanmakuOpacity,
- min: 0.1,
- max: 1,
- label: '${(defaultDanmakuOpacity * 100).round()}%',
- onChanged: (value) {
- updateDanmakuOpacity(
- double.parse(value.toStringAsFixed(2)));
- },
- ),
+ value: defaultDanmakuOpacity,
+ min: 0.1,
+ max: 1,
+ valueLabel: '${(defaultDanmakuOpacity * 100).round()}%',
+ onChanged: (value) => updateDanmakuOpacity(
+ double.parse(value.toStringAsFixed(2))),
),
],
),
diff --git a/lib/pages/settings/danmaku/danmaku_settings_sheet.dart b/lib/pages/settings/danmaku/danmaku_settings_sheet.dart
index b3ef486a..40fdf2e5 100644
--- a/lib/pages/settings/danmaku/danmaku_settings_sheet.dart
+++ b/lib/pages/settings/danmaku/danmaku_settings_sheet.dart
@@ -58,6 +58,12 @@ class _DanmakuSettingsSheet extends StatefulWidget {
}
class _DanmakuSettingsSheetState extends State<_DanmakuSettingsSheet> {
+ DanmakuOption get _option => widget.danmakuController.option;
+
+ void _applyOption(DanmakuOption option) {
+ setState(() => widget.danmakuController.updateOption(option));
+ }
+
void _showDanmakuShieldSheet() {
showAdaptiveBottomSheet<void>(
context: context,
@@ -95,49 +101,33 @@ class _DanmakuSettingsSheetState extends State<_DanmakuSettingsSheet> {
SettingsSection(
title: Text('弹幕样式'),
tiles: [
- SettingsTile(
+ SettingsSliderTile(
leading: Icons.format_size_rounded,
title: Text('字体大小'),
- description: Slider(
- value: widget.danmakuController.option.fontSize,
- min: 10,
- max: isCompact() ? 32 : 48,
- label:
- '${widget.danmakuController.option.fontSize.floorToDouble()}',
- onChanged: (value) {
- setState(
- () => widget.danmakuController.updateOption(
- widget.danmakuController.option.copyWith(
- fontSize: value.floorToDouble(),
- ),
- ));
- GStorage.putSetting<double>(
- SettingsKeys.danmakuFontSize,
- value.floorToDouble());
- },
- ),
+ value: _option.fontSize,
+ min: 10,
+ max: isCompact() ? 32 : 48,
+ valueLabel: '${_option.fontSize.floor()}',
+ onChanged: (value) {
+ final fontSize = value.floorToDouble();
+ _applyOption(_option.copyWith(fontSize: fontSize));
+ GStorage.putSetting<double>(
+ SettingsKeys.danmakuFontSize, fontSize);
+ },
),
- SettingsTile(
+ SettingsSliderTile(
leading: Icons.opacity_rounded,
title: Text('弹幕不透明度'),
- description: Slider(
- value: widget.danmakuController.option.opacity,
- min: 0.1,
- max: 1,
- label:
- '${(widget.danmakuController.option.opacity * 100).round()}%',
- onChanged: (value) {
- setState(
- () => widget.danmakuController.updateOption(
- widget.danmakuController.option.copyWith(
- opacity: value,
- ),
- ));
- GStorage.putSetting<double>(
- SettingsKeys.danmakuOpacity,
- double.parse(value.toStringAsFixed(2)));
- },
- ),
+ value: _option.opacity,
+ min: 0.1,
+ max: 1,
+ valueLabel: '${(_option.opacity * 100).round()}%',
+ onChanged: (value) {
+ _applyOption(_option.copyWith(opacity: value));
+ GStorage.putSetting<double>(
+ SettingsKeys.danmakuOpacity,
+ double.parse(value.toStringAsFixed(2)));
+ },
),
],
),
@@ -160,125 +150,84 @@ class _DanmakuSettingsSheetState extends State<_DanmakuSettingsSheet> {
),
),
),
- SettingsTile(
+ SettingsSliderTile(
leading: Icons.crop_free_rounded,
title: Text('弹幕区域'),
- description: Slider(
- value: widget.danmakuController.option.area,
- min: 0,
- max: 1,
- divisions: 8,
- label:
- '${(widget.danmakuController.option.area * 100).round()}%',
- onChanged: (value) {
- setState(
- () => widget.danmakuController.updateOption(
- widget.danmakuController.option.copyWith(
- area: value,
- ),
- ));
- GStorage.putSetting<double>(
- SettingsKeys.danmakuArea, value);
- },
- ),
+ value: _option.area,
+ min: 0,
+ max: 1,
+ divisions: 8,
+ valueLabel: '${(_option.area * 100).round()}%',
+ onChanged: (value) {
+ _applyOption(_option.copyWith(area: value));
+ GStorage.putSetting<double>(
+ SettingsKeys.danmakuArea, value);
+ },
),
- SettingsTile(
+ SettingsSliderTile(
leading: Icons.timer_rounded,
title: Text('持续时间'),
- description: Slider(
- value: widget.danmakuController.option.duration
- .toDouble(),
- min: 2,
- max: 16,
- divisions: 14,
- label:
- '${widget.danmakuController.option.duration.round()}',
- onChanged: (value) {
- setState(
- () => widget.danmakuController.updateOption(
- widget.danmakuController.option.copyWith(
- duration: value,
- ),
- ));
- GStorage.putSetting<double>(
- SettingsKeys.danmakuDuration,
- value.round().toDouble());
- },
- ),
+ value: _option.duration.toDouble(),
+ min: 2,
+ max: 16,
+ divisions: 14,
+ valueLabel: '${_option.duration.round()} 秒',
+ onChanged: (value) {
+ _applyOption(_option.copyWith(duration: value));
+ GStorage.putSetting<double>(
+ SettingsKeys.danmakuDuration,
+ value.roundToDouble());
+ },
),
- SettingsTile(
+ SettingsSliderTile(
leading: Icons.format_line_spacing_rounded,
title: Text('行高'),
- description: Slider(
- value: widget.danmakuController.option.lineHeight,
- min: 0,
- max: 3,
- divisions: 30,
- label: widget.danmakuController.option.lineHeight
- .toStringAsFixed(1),
- onChanged: (value) {
- setState(() =>
- widget.danmakuController.updateOption(
- widget.danmakuController.option.copyWith(
- lineHeight:
- double.parse(value.toStringAsFixed(1)),
- ),
- ));
- GStorage.putSetting<double>(
- SettingsKeys.danmakuLineHeight,
- double.parse(value.toStringAsFixed(1)));
- },
- ),
+ value: _option.lineHeight,
+ min: 0,
+ max: 3,
+ divisions: 30,
+ valueLabel: _option.lineHeight.toStringAsFixed(1),
+ onChanged: (value) {
+ final lineHeight =
+ double.parse(value.toStringAsFixed(1));
+ _applyOption(
+ _option.copyWith(lineHeight: lineHeight));
+ GStorage.putSetting<double>(
+ SettingsKeys.danmakuLineHeight, lineHeight);
+ },
),
SettingsTile.switchTile(
leading: Icons.vertical_align_top_rounded,
onToggle: (value) {
- bool show =
- value ?? widget.danmakuController.option.hideTop;
- setState(() => widget.danmakuController.updateOption(
- widget.danmakuController.option.copyWith(
- hideTop: !show,
- ),
- ));
+ final show = value ?? _option.hideTop;
+ _applyOption(_option.copyWith(hideTop: !show));
GStorage.putSetting<bool>(
SettingsKeys.danmakuTop, show);
},
title: Text('顶部弹幕'),
- initialValue: !widget.danmakuController.option.hideTop,
+ initialValue: !_option.hideTop,
),
SettingsTile.switchTile(
leading: Icons.vertical_align_bottom_rounded,
onToggle: (value) {
- bool show = value ??
- widget.danmakuController.option.hideBottom;
- setState(() => widget.danmakuController.updateOption(
- widget.danmakuController.option.copyWith(
- hideBottom: !show,
- ),
- ));
+ final show = value ?? _option.hideBottom;
+ _applyOption(_option.copyWith(hideBottom: !show));
GStorage.putSetting<bool>(
SettingsKeys.danmakuBottom, show);
},
title: Text('底部弹幕'),
- initialValue:
- !widget.danmakuController.option.hideBottom,
+ initialValue: !_option.hideBottom,
),
SettingsTile.switchTile(
leading: Icons.swap_horiz_rounded,
onToggle: (value) {
- bool show = value ??
- widget.danmakuController.option.hideScroll;
- setState(() => widget.danmakuController.updateOption(
- widget.danmakuController.option.copyWith(
- hideScroll: !show,
- ),
- ));
+ final show = value ?? _option.hideScroll;
+ _applyOption(_option.copyWith(hideScroll: !show));
GStorage.putSetting<bool>(
SettingsKeys.danmakuScroll, show);
},
title: Text('滚动弹幕'),
- initialValue:
- !widget.danmakuController.option.hideScroll,
+ initialValue: !_option.hideScroll,
),
SettingsTile.switchTile(
leading: Icons.speed_rounded,
diff --git a/lib/pages/settings/download_settings.dart b/lib/pages/settings/download_settings.dart
index 874d7b64..3fd8eebd 100644
--- a/lib/pages/settings/download_settings.dart
+++ b/lib/pages/settings/download_settings.dart
@@ -115,57 +115,39 @@ class _DownloadSettingsPageState extends State<DownloadSettingsPage> {
SettingsSection(
title: Text('并发设置'),
tiles: [
- SettingsTile(
+ SettingsSliderTile(
leading: Icons.video_library_rounded,
title: Text('同时下载集数'),
- description: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- '同时下载 $parallelEpisodes 集',
- ),
- Slider(
- value: parallelEpisodes.toDouble(),
- min: 1,
- max: 5,
- divisions: 4,
- label: '$parallelEpisodes',
- onChanged: (value) {
- setState(() => parallelEpisodes = value.toInt());
- GStorage.putSetting(
- SettingsKeys.downloadParallelEpisodes,
- parallelEpisodes,
- );
- },
- ),
- ],
- ),
+ description: Text('并行下载的剧集数量'),
+ value: parallelEpisodes.toDouble(),
+ min: 1,
+ max: 5,
+ divisions: 4,
+ valueLabel: '$parallelEpisodes 集',
+ onChanged: (value) {
+ setState(() => parallelEpisodes = value.toInt());
+ GStorage.putSetting(
+ SettingsKeys.downloadParallelEpisodes,
+ parallelEpisodes,
+ );
+ },
),
- SettingsTile(
+ SettingsSliderTile(
leading: Icons.call_split_rounded,
title: Text('分片并发数'),
- description: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- '每集同时下载 $parallelSegments 个分片',
- ),
- Slider(
- value: parallelSegments.toDouble(),
- min: 1,
- max: 10,
- divisions: 9,
- label: '$parallelSegments',
- onChanged: (value) {
- setState(() => parallelSegments = value.toInt());
- GStorage.putSetting(
- SettingsKeys.downloadParallelSegments,
- parallelSegments,
- );
- },
- ),
- ],
- ),
+ description: Text('每集同时下载的分片数量'),
+ value: parallelSegments.toDouble(),
+ min: 1,
+ max: 10,
+ divisions: 9,
+ valueLabel: '$parallelSegments 个',
+ onChanged: (value) {
+ setState(() => parallelSegments = value.toInt());
+ GStorage.putSetting(
+ SettingsKeys.downloadParallelSegments,
+ parallelSegments,
+ );
+ },
),
],
),
diff --git a/lib/pages/settings/player_settings.dart b/lib/pages/settings/player_settings.dart
index 2cb60a1e..7cf40e21 100644
--- a/lib/pages/settings/player_settings.dart
+++ b/lib/pages/settings/player_settings.dart
@@ -531,57 +531,49 @@ class _PlayerSettingsPageState extends State<PlayerSettingsPage> {
SettingsSection(
title: Text('播放参数'),
tiles: [
- SettingsTile(
+ SettingsSliderTile(
leading: Icons.speed_rounded,
title: Text('默认倍速'),
- description: Slider(
- value: defaultPlaySpeed,
- min: 0.25,
- max: 3,
- divisions: 11,
- label: '${defaultPlaySpeed}x',
- onChanged: (value) {
- updateDefaultPlaySpeed(
- double.parse(value.toStringAsFixed(2)));
- },
- ),
+ value: defaultPlaySpeed,
+ min: 0.25,
+ max: 3,
+ divisions: 11,
+ valueLabel: '${defaultPlaySpeed}x',
+ onChanged: (value) => updateDefaultPlaySpeed(
+ double.parse(value.toStringAsFixed(2))),
),
- SettingsTile(
+ SettingsSliderTile(
leading: Icons.fast_forward_rounded,
- title: Text('默认方向键/长按倍速'),
- description: Slider(
- value: defaultShortcutForwardPlaySpeed,
- min: 1.25,
- max: 3,
- divisions: 7,
- label: '${defaultShortcutForwardPlaySpeed}x',
- onChanged: (value) {
- updateDefaultShortcutForwardPlaySpeed(
- double.parse(value.toStringAsFixed(2)));
- },
- ),
+ title: Text('长按倍速'),
+ description: Text('长按屏幕或按住方向键时的倍速'),
+ value: defaultShortcutForwardPlaySpeed,
+ min: 1.25,
+ max: 3,
+ divisions: 7,
+ valueLabel: '${defaultShortcutForwardPlaySpeed}x',
+ onChanged: (value) => updateDefaultShortcutForwardPlaySpeed(
+ double.parse(value.toStringAsFixed(2))),
),
- SettingsTile(
+ SettingsSliderTile(
leading: Icons.swap_horiz_rounded,
- description: Slider(
- value: playerArrowKeySkipTime.toDouble(),
- min: 0,
- max: 15,
- divisions: 15,
- label: '$playerArrowKeySkipTime秒',
- onChanged: (value) {
- final newArrowKeySkipTime = value.toInt();
-
- if (value != playerArrowKeySkipTime) {
- GStorage.putSetting<int>(
- SettingsKeys.arrowKeySkipTime, newArrowKeySkipTime);
- setState(() {
- playerArrowKeySkipTime = newArrowKeySkipTime;
- });
- }
- },
- ),
- title: Text('左右方向键的快进/快退秒数'),
+ title: Text('方向键跳转'),
+ description: Text('左右方向键的快进/快退秒数'),
+ value: playerArrowKeySkipTime.toDouble(),
+ min: 0,
+ max: 15,
+ divisions: 15,
+ valueLabel: '$playerArrowKeySkipTime 秒',
+ onChanged: (value) {
+ final newArrowKeySkipTime = value.toInt();
+ if (newArrowKeySkipTime == playerArrowKeySkipTime) {
+ return;
+ }
+ GStorage.putSetting<int>(
+ SettingsKeys.arrowKeySkipTime, newArrowKeySkipTime);
+ setState(() {
+ playerArrowKeySkipTime = newArrowKeySkipTime;
+ });
+ },
),
SettingsTile(
leading: Icons.skip_next_rounded,
@@ -592,19 +584,17 @@ class _PlayerSettingsPageState extends State<PlayerSettingsPage> {
description: Text('顶栏跳过按钮的秒数'),
value: Text('$playerButtonSkipTime 秒'),
),
- SettingsTile(
+ SettingsSliderTile(
leading: Icons.timer_rounded,
- title: Text(
- '播放控制器消失时间:${formatPlayerControllerLayerDisappearSeconds(playerControllerLayerDisappearSeconds)}'),
- description: Slider(
- value: playerControllerLayerDisappearSeconds,
- min: _minPlayerControllerLayerDisappearSeconds,
- max: _maxPlayerControllerLayerDisappearSeconds,
- divisions: _playerControllerLayerDisappearDivisions,
- label: formatPlayerControllerLayerDisappearSeconds(
- playerControllerLayerDisappearSeconds),
- onChanged: updatePlayerControllerLayerDisappearSeconds,
- ),
+ title: Text('控制栏消失时间'),
+ description: Text('播放控制器自动隐藏前的停留时长'),
+ value: playerControllerLayerDisappearSeconds,
+ min: _minPlayerControllerLayerDisappearSeconds,
+ max: _maxPlayerControllerLayerDisappearSeconds,
+ divisions: _playerControllerLayerDisappearDivisions,
+ valueLabel: formatPlayerControllerLayerDisappearSeconds(
+ playerControllerLayerDisappearSeconds),
+ onChanged: updatePlayerControllerLayerDisappearSeconds,
),
SettingsTile(
leading: Icons.aspect_ratio_rounded,