mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-06-28 13:20:16 +08:00
tweaks (#2426)
* opt: danmaku weight
* opt: cache clean
* opt: level img
* opt: play icon
* opt: svg big-vip
* opt: webview ua
* opt: simple dialog
* feat: export vtt
* tweak
* opt: mapIndexed
* feat: more subtitle
* refa: settings page
* feat: codec list options
* drawPath
Signed-off-by: dom <githubaccount56556@proton.me>
* custom dialog option
Signed-off-by: dom <githubaccount56556@proton.me>
* update
Signed-off-by: dom <githubaccount56556@proton.me>
* Revert "drawPath"
This reverts commit e8a4b19f0f.
* opt: _initStreamIndex
* fix: avoid gap
* fix: scale [skip ci]
* fix: hide repost menu not login
* tweaks
Signed-off-by: dom <githubaccount56556@proton.me>
---------
Co-authored-by: dom <githubaccount56556@proton.me>
This commit is contained in:
committed by
GitHub
parent
3dee6a85e5
commit
9d94c72e95
@@ -2,6 +2,7 @@ import 'dart:io';
|
||||
import 'dart:math' show max;
|
||||
|
||||
import 'package:PiliPlus/common/widgets/custom_icon.dart';
|
||||
import 'package:PiliPlus/common/widgets/dialog/simple_dialog_option.dart';
|
||||
import 'package:PiliPlus/common/widgets/flutter/refresh_indicator.dart';
|
||||
import 'package:PiliPlus/common/widgets/gesture/horizontal_drag_gesture_recognizer.dart'
|
||||
show deviceTouchSlop, touchSlopH;
|
||||
@@ -595,19 +596,10 @@ List<SettingsModel> get extraSettings => [
|
||||
onTap: _showProxyDialog,
|
||||
),
|
||||
),
|
||||
const SwitchModel(
|
||||
title: '自动清除缓存',
|
||||
subtitle: '每次启动时清除缓存',
|
||||
leading: Icon(Icons.auto_delete_outlined),
|
||||
setKey: SettingBoxKey.autoClearCache,
|
||||
defaultVal: false,
|
||||
),
|
||||
NormalModel(
|
||||
title: '最大缓存大小',
|
||||
getSubtitle: () {
|
||||
final num = Pref.maxCacheSize;
|
||||
return '当前最大缓存大小: 「${num == 0 ? '无限' : CacheManager.formatSize(Pref.maxCacheSize)}」';
|
||||
},
|
||||
getSubtitle: () =>
|
||||
'当前最大缓存大小: 「${CacheManager.formatSize(Pref.maxCacheSize)}」',
|
||||
leading: const Icon(Icons.delete_outlined),
|
||||
onTap: _showCacheDialog,
|
||||
),
|
||||
@@ -721,48 +713,42 @@ Future<void> audioNormalization(
|
||||
void _showDownPathDialog(BuildContext context, VoidCallback setState) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
builder: (context) => SimpleDialog(
|
||||
clipBehavior: Clip.hardEdge,
|
||||
contentPadding: const EdgeInsets.symmetric(vertical: 12),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
ListTile(
|
||||
onTap: () {
|
||||
Get.back();
|
||||
Utils.copyText(downloadPath);
|
||||
},
|
||||
dense: true,
|
||||
title: const Text('复制', style: TextStyle(fontSize: 14)),
|
||||
),
|
||||
ListTile(
|
||||
onTap: () {
|
||||
Get.back();
|
||||
final defPath = defDownloadPath;
|
||||
if (downloadPath == defPath) return;
|
||||
downloadPath = defPath;
|
||||
setState();
|
||||
Get.find<DownloadService>().initDownloadList();
|
||||
GStorage.setting.delete(SettingBoxKey.downloadPath);
|
||||
},
|
||||
dense: true,
|
||||
title: const Text('重置', style: TextStyle(fontSize: 14)),
|
||||
),
|
||||
ListTile(
|
||||
onTap: () async {
|
||||
Get.back();
|
||||
final path = await FilePicker.getDirectoryPath();
|
||||
if (path == null || path == downloadPath) return;
|
||||
downloadPath = path;
|
||||
setState();
|
||||
Get.find<DownloadService>().initDownloadList();
|
||||
GStorage.setting.put(SettingBoxKey.downloadPath, path);
|
||||
},
|
||||
dense: true,
|
||||
title: const Text('设置新路径', style: TextStyle(fontSize: 14)),
|
||||
),
|
||||
],
|
||||
),
|
||||
children: [
|
||||
DialogOption(
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
Utils.copyText(downloadPath);
|
||||
},
|
||||
child: const Text('复制', style: TextStyle(fontSize: 14)),
|
||||
),
|
||||
DialogOption(
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
final defPath = defDownloadPath;
|
||||
if (downloadPath == defPath) return;
|
||||
downloadPath = defPath;
|
||||
setState();
|
||||
Get.find<DownloadService>().initDownloadList();
|
||||
GStorage.setting.delete(SettingBoxKey.downloadPath);
|
||||
},
|
||||
child: const Text('重置', style: TextStyle(fontSize: 14)),
|
||||
),
|
||||
DialogOption(
|
||||
onPressed: () async {
|
||||
Get.back();
|
||||
final path = await FilePicker.getDirectoryPath();
|
||||
if (path == null || path == downloadPath) return;
|
||||
downloadPath = path;
|
||||
setState();
|
||||
Get.find<DownloadService>().initDownloadList();
|
||||
GStorage.setting.put(SettingBoxKey.downloadPath, path);
|
||||
},
|
||||
child: const Text('设置新路径', style: TextStyle(fontSize: 14)),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -25,9 +25,7 @@ List<SettingsModel> get privacySettings => [
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: const Text('账号模式详情'),
|
||||
content: SingleChildScrollView(
|
||||
child: _getAccountDetail(context),
|
||||
),
|
||||
content: SingleChildScrollView(child: _getAccountDetail(context)),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: Get.back,
|
||||
|
||||
@@ -93,8 +93,8 @@ List<SettingsModel> get recommendSettings => [
|
||||
onChanged: (value) => RecommendFilter.exemptFilterForFollowed = value,
|
||||
),
|
||||
SwitchModel(
|
||||
title: '过滤器也应用于相关视频',
|
||||
subtitle: '视频详情页的相关视频也进行过滤¹',
|
||||
title: '过滤器也应用于详情页相关视频',
|
||||
subtitle: '其它(如热门视频、搜索等)均不受过滤器影响,无法豁免相关视频中的已关注UP',
|
||||
leading: const Icon(Icons.explore_outlined),
|
||||
setKey: SettingBoxKey.applyFilterToRelatedVideos,
|
||||
defaultVal: true,
|
||||
|
||||
@@ -127,16 +127,11 @@ List<SettingsModel> get videoSettings => [
|
||||
NormalModel(
|
||||
title: '首选解码格式',
|
||||
leading: const Icon(Icons.movie_creation_outlined),
|
||||
getSubtitle: () =>
|
||||
'首选解码格式:${VideoDecodeFormatType.fromCode(Pref.defaultDecode).description},请根据设备支持情况与需求调整',
|
||||
onTap: _showDecodeDialog,
|
||||
),
|
||||
NormalModel(
|
||||
title: '次选解码格式',
|
||||
getSubtitle: () =>
|
||||
'非杜比视频次选:${VideoDecodeFormatType.fromCode(Pref.secondDecode).description},仍无则选择首个提供的解码格式',
|
||||
leading: const Icon(Icons.swap_horizontal_circle_outlined),
|
||||
onTap: _showSecondDecodeDialog,
|
||||
getSubtitle: () {
|
||||
final list = Pref.preferCodecs;
|
||||
return '首选解码格式:${(list.isEmpty ? '第一个可用' : list.map((i) => i.name).join(","))},请根据设备支持情况与需求调整';
|
||||
},
|
||||
onTap: _showCodecsDialog,
|
||||
),
|
||||
if (kDebugMode || Platform.isAndroid)
|
||||
NormalModel(
|
||||
@@ -349,42 +344,25 @@ Future<void> _showLiveCellularQaDialog(
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _showDecodeDialog(
|
||||
Future<void> _showCodecsDialog(
|
||||
BuildContext context,
|
||||
VoidCallback setState,
|
||||
) async {
|
||||
final res = await showDialog<String>(
|
||||
final res = await showDialog<List<VideoDecodeFormatType>>(
|
||||
context: context,
|
||||
builder: (context) => SelectDialog<String>(
|
||||
title: '默认解码格式',
|
||||
value: Pref.defaultDecode,
|
||||
values: VideoDecodeFormatType.values
|
||||
.map((e) => (e.codes.first, e.description))
|
||||
.toList(),
|
||||
builder: (context) => OrderedMultiSelectDialog<VideoDecodeFormatType>(
|
||||
title: '首选解码格式',
|
||||
initValues: Pref.preferCodecs,
|
||||
values: {for (final e in VideoDecodeFormatType.values) e: e.name},
|
||||
),
|
||||
);
|
||||
if (res != null) {
|
||||
await GStorage.setting.put(SettingBoxKey.defaultDecode, res);
|
||||
setState();
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _showSecondDecodeDialog(
|
||||
BuildContext context,
|
||||
VoidCallback setState,
|
||||
) async {
|
||||
final res = await showDialog<String>(
|
||||
context: context,
|
||||
builder: (context) => SelectDialog<String>(
|
||||
title: '次选解码格式',
|
||||
value: Pref.secondDecode,
|
||||
values: VideoDecodeFormatType.values
|
||||
.map((e) => (e.codes.first, e.description))
|
||||
.toList(),
|
||||
),
|
||||
);
|
||||
if (res != null) {
|
||||
await GStorage.setting.put(SettingBoxKey.secondDecode, res);
|
||||
await (res.isEmpty
|
||||
? GStorage.setting.delete(SettingBoxKey.preferCodecs)
|
||||
: GStorage.setting.put(
|
||||
SettingBoxKey.preferCodecs,
|
||||
res.map((i) => i.name).toList(),
|
||||
));
|
||||
setState();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user