mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-14 21:24:02 +08:00
@@ -20,18 +20,15 @@ import 'package:PiliPlus/models/common/super_resolution_type.dart';
|
||||
import 'package:PiliPlus/models/dynamics/result.dart'
|
||||
show DynamicsDataModel, ItemModulesModel;
|
||||
import 'package:PiliPlus/pages/common/slide/common_slide_page.dart';
|
||||
import 'package:PiliPlus/pages/home/controller.dart';
|
||||
import 'package:PiliPlus/pages/main/controller.dart';
|
||||
import 'package:PiliPlus/pages/setting/models/model.dart';
|
||||
import 'package:PiliPlus/pages/setting/widgets/select_dialog.dart';
|
||||
import 'package:PiliPlus/pages/setting/widgets/slider_dialog.dart';
|
||||
import 'package:PiliPlus/pages/video/reply/widgets/reply_item_grpc.dart';
|
||||
import 'package:PiliPlus/plugin/pl_player/controller.dart';
|
||||
import 'package:PiliPlus/services/download/download_service.dart';
|
||||
import 'package:PiliPlus/utils/accounts.dart';
|
||||
import 'package:PiliPlus/utils/cache_manager.dart';
|
||||
import 'package:PiliPlus/utils/extension/num_ext.dart';
|
||||
import 'package:PiliPlus/utils/feed_back.dart';
|
||||
import 'package:PiliPlus/utils/global_data.dart';
|
||||
import 'package:PiliPlus/utils/image_utils.dart';
|
||||
import 'package:PiliPlus/utils/path_utils.dart';
|
||||
@@ -39,7 +36,6 @@ import 'package:PiliPlus/utils/platform_utils.dart';
|
||||
import 'package:PiliPlus/utils/storage.dart';
|
||||
import 'package:PiliPlus/utils/storage_key.dart';
|
||||
import 'package:PiliPlus/utils/storage_pref.dart';
|
||||
import 'package:PiliPlus/utils/update.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:file_picker/file_picker.dart';
|
||||
import 'package:flutter/foundation.dart' show kDebugMode;
|
||||
@@ -169,16 +165,6 @@ List<SettingsModel> get extraSettings => [
|
||||
defaultVal: false,
|
||||
onChanged: (value) => ImageGridView.horizontalPreview = value,
|
||||
),
|
||||
NormalModel(
|
||||
title: '评论折叠行数',
|
||||
subtitle: '0行为不折叠',
|
||||
leading: const Icon(Icons.compress),
|
||||
getTrailing: (theme) => Text(
|
||||
'${ReplyItemGrpc.replyLengthLimit}行',
|
||||
style: theme.textTheme.titleSmall,
|
||||
),
|
||||
onTap: _showReplyLengthDialog,
|
||||
),
|
||||
NormalModel(
|
||||
title: '弹幕行高',
|
||||
subtitle: '默认1.6',
|
||||
@@ -316,13 +302,6 @@ List<SettingsModel> get extraSettings => [
|
||||
setKey: SettingBoxKey.preInitPlayer,
|
||||
defaultVal: false,
|
||||
),
|
||||
const SwitchModel(
|
||||
title: '首页切换页面动画',
|
||||
leading: Icon(Icons.home_outlined),
|
||||
setKey: SettingBoxKey.mainTabBarView,
|
||||
defaultVal: false,
|
||||
needReboot: true,
|
||||
),
|
||||
const SwitchModel(
|
||||
title: '搜索建议',
|
||||
leading: Icon(Icons.search),
|
||||
@@ -453,12 +432,6 @@ List<SettingsModel> get extraSettings => [
|
||||
defaultVal: Platform.isIOS,
|
||||
onChanged: (value) => CommonSlideMixin.slideDismissReplyPage = value,
|
||||
),
|
||||
const SwitchModel(
|
||||
title: '启用双指缩小视频',
|
||||
leading: Icon(Icons.pinch),
|
||||
setKey: SettingBoxKey.enableShrinkVideoSize,
|
||||
defaultVal: true,
|
||||
),
|
||||
const SwitchModel(
|
||||
title: '动态/专栏详情页展示底部操作栏',
|
||||
leading: Icon(Icons.more_horiz),
|
||||
@@ -493,16 +466,6 @@ List<SettingsModel> get extraSettings => [
|
||||
defaultVal: false,
|
||||
onChanged: (value) => ImageGridView.enableImgMenu = value,
|
||||
),
|
||||
SwitchModel(
|
||||
setKey: SettingBoxKey.feedBackEnable,
|
||||
onChanged: (value) {
|
||||
enableFeedback = value;
|
||||
feedBack();
|
||||
},
|
||||
leading: const Icon(Icons.vibration_outlined),
|
||||
title: '震动反馈',
|
||||
subtitle: '请确定手机设置中已开启震动反馈',
|
||||
),
|
||||
const SwitchModel(
|
||||
title: '大家都在搜',
|
||||
subtitle: '是否展示「大家都在搜」',
|
||||
@@ -517,23 +480,6 @@ List<SettingsModel> get extraSettings => [
|
||||
setKey: SettingBoxKey.enableSearchRcmd,
|
||||
defaultVal: true,
|
||||
),
|
||||
SwitchModel(
|
||||
title: '搜索默认词',
|
||||
subtitle: '是否展示搜索框默认词',
|
||||
leading: const Icon(Icons.whatshot_outlined),
|
||||
setKey: SettingBoxKey.enableSearchWord,
|
||||
defaultVal: false,
|
||||
onChanged: (val) {
|
||||
try {
|
||||
final controller = Get.find<HomeController>()..enableSearchWord = val;
|
||||
if (val) {
|
||||
controller.querySearchDefault();
|
||||
} else {
|
||||
controller.defaultSearch.value = '';
|
||||
}
|
||||
} catch (_) {}
|
||||
},
|
||||
),
|
||||
const SwitchModel(
|
||||
title: '快速收藏',
|
||||
subtitle: '点击设置默认收藏夹\n点按收藏至默认,长按选择文件夹',
|
||||
@@ -542,14 +488,6 @@ List<SettingsModel> get extraSettings => [
|
||||
onTap: _showFavDialog,
|
||||
defaultVal: false,
|
||||
),
|
||||
SwitchModel(
|
||||
title: '评论区搜索关键词',
|
||||
subtitle: '展示评论区搜索关键词',
|
||||
leading: const Icon(Icons.search_outlined),
|
||||
setKey: SettingBoxKey.enableWordRe,
|
||||
defaultVal: false,
|
||||
onChanged: (value) => ReplyItemGrpc.enableWordRe = value,
|
||||
),
|
||||
const SwitchModel(
|
||||
title: '启用AI总结',
|
||||
subtitle: '视频详情页开启AI总结',
|
||||
@@ -557,13 +495,6 @@ List<SettingsModel> get extraSettings => [
|
||||
setKey: SettingBoxKey.enableAi,
|
||||
defaultVal: false,
|
||||
),
|
||||
const SwitchModel(
|
||||
title: '消息页禁用"收到的赞"功能',
|
||||
subtitle: '禁止打开入口,降低网络社交依赖',
|
||||
leading: Icon(Icons.beach_access_outlined),
|
||||
setKey: SettingBoxKey.disableLikeMsg,
|
||||
defaultVal: false,
|
||||
),
|
||||
const SwitchModel(
|
||||
title: '默认展示评论区',
|
||||
subtitle: '在视频详情页默认切换至评论区页(仅Tab型布局)',
|
||||
@@ -651,18 +582,6 @@ List<SettingsModel> get extraSettings => [
|
||||
leading: const Icon(Icons.delete_outlined),
|
||||
onTap: _showCacheDialog,
|
||||
),
|
||||
SwitchModel(
|
||||
title: '检查更新',
|
||||
subtitle: '每次启动时检查是否需要更新',
|
||||
leading: const Icon(Icons.system_update_alt),
|
||||
setKey: SettingBoxKey.autoUpdate,
|
||||
defaultVal: true,
|
||||
onChanged: (val) {
|
||||
if (val) {
|
||||
Update.checkUpdate(false);
|
||||
}
|
||||
},
|
||||
),
|
||||
];
|
||||
|
||||
Future<void> audioNormalization(
|
||||
@@ -847,47 +766,6 @@ void _showDynDialog(BuildContext context) {
|
||||
);
|
||||
}
|
||||
|
||||
void _showReplyLengthDialog(BuildContext context, VoidCallback setState) {
|
||||
String replyLengthLimit = ReplyItemGrpc.replyLengthLimit.toString();
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: const Text('评论折叠行数'),
|
||||
content: TextFormField(
|
||||
autofocus: true,
|
||||
initialValue: replyLengthLimit,
|
||||
keyboardType: TextInputType.number,
|
||||
onChanged: (value) => replyLengthLimit = value,
|
||||
inputFormatters: [FilteringTextInputFormatter.digitsOnly],
|
||||
decoration: const InputDecoration(suffixText: '行'),
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: Get.back,
|
||||
child: Text(
|
||||
'取消',
|
||||
style: TextStyle(color: ColorScheme.of(context).outline),
|
||||
),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
try {
|
||||
final val = int.parse(replyLengthLimit);
|
||||
Get.back();
|
||||
ReplyItemGrpc.replyLengthLimit = val == 0 ? null : val;
|
||||
await GStorage.setting.put(SettingBoxKey.replyLengthLimit, val);
|
||||
setState();
|
||||
} catch (e) {
|
||||
SmartDialog.showToast(e.toString());
|
||||
}
|
||||
},
|
||||
child: const Text('确定'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _showDmHeightDialog(BuildContext context, VoidCallback setState) {
|
||||
String danmakuLineHeight = Pref.danmakuLineHeight.toString();
|
||||
showDialog(
|
||||
|
||||
@@ -134,11 +134,11 @@ List<SettingsModel> get playSettings => [
|
||||
} catch (_) {}
|
||||
},
|
||||
),
|
||||
const SwitchModel(
|
||||
SwitchModel(
|
||||
title: '启用键盘控制',
|
||||
leading: Icon(Icons.keyboard_alt_outlined),
|
||||
leading: const Icon(Icons.keyboard_alt_outlined),
|
||||
setKey: SettingBoxKey.keyboardControl,
|
||||
defaultVal: true,
|
||||
defaultVal: PlatformUtils.isDesktop,
|
||||
),
|
||||
NormalModel(
|
||||
title: 'SuperChat (醒目留言) 显示类型',
|
||||
@@ -173,13 +173,6 @@ List<SettingsModel> get playSettings => [
|
||||
setKey: SettingBoxKey.enableAutoExit,
|
||||
defaultVal: true,
|
||||
),
|
||||
const SwitchModel(
|
||||
title: '延长播放控件显示时间',
|
||||
subtitle: '开启后延长至30秒,便于屏幕阅读器滑动切换控件焦点',
|
||||
leading: Icon(Icons.timer_outlined),
|
||||
setKey: SettingBoxKey.enableLongShowControl,
|
||||
defaultVal: false,
|
||||
),
|
||||
if (PlatformUtils.isMobile)
|
||||
const SwitchModel(
|
||||
title: '后台播放',
|
||||
|
||||
@@ -3,7 +3,7 @@ import 'package:PiliPlus/pages/rcmd/controller.dart';
|
||||
import 'package:PiliPlus/pages/setting/models/model.dart';
|
||||
import 'package:PiliPlus/utils/recommend_filter.dart';
|
||||
import 'package:PiliPlus/utils/storage_key.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/foundation.dart' show kDebugMode;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
|
||||
@@ -2,9 +2,6 @@ import 'dart:io';
|
||||
import 'dart:math' as math;
|
||||
|
||||
import 'package:PiliPlus/common/widgets/color_palette.dart';
|
||||
import 'package:PiliPlus/common/widgets/custom_toast.dart';
|
||||
import 'package:PiliPlus/common/widgets/dialog/dialog.dart';
|
||||
import 'package:PiliPlus/common/widgets/image/network_img_layer.dart';
|
||||
import 'package:PiliPlus/common/widgets/scale_app.dart';
|
||||
import 'package:PiliPlus/common/widgets/stateful_builder.dart';
|
||||
import 'package:PiliPlus/models/common/bar_hide_type.dart';
|
||||
@@ -18,7 +15,6 @@ import 'package:PiliPlus/models/common/theme/theme_type.dart';
|
||||
import 'package:PiliPlus/pages/main/controller.dart';
|
||||
import 'package:PiliPlus/pages/mine/controller.dart';
|
||||
import 'package:PiliPlus/pages/setting/models/model.dart';
|
||||
import 'package:PiliPlus/pages/setting/slide_color_picker.dart';
|
||||
import 'package:PiliPlus/pages/setting/widgets/dual_slider_dialog.dart';
|
||||
import 'package:PiliPlus/pages/setting/widgets/multi_select_dialog.dart';
|
||||
import 'package:PiliPlus/pages/setting/widgets/select_dialog.dart';
|
||||
@@ -74,27 +70,6 @@ List<SettingsModel> get styleSettings => [
|
||||
}
|
||||
},
|
||||
),
|
||||
const SwitchModel(
|
||||
title: '改用侧边栏',
|
||||
subtitle: '开启后底栏与顶栏被替换,且相关设置失效',
|
||||
leading: Icon(Icons.chrome_reader_mode_outlined),
|
||||
setKey: SettingBoxKey.useSideBar,
|
||||
defaultVal: false,
|
||||
needReboot: true,
|
||||
),
|
||||
SplitModel(
|
||||
normalModel: const NormalModel.split(
|
||||
title: 'App字体字重',
|
||||
subtitle: '点击设置',
|
||||
leading: Icon(Icons.text_fields),
|
||||
),
|
||||
switchModel: SwitchModel.split(
|
||||
defaultVal: false,
|
||||
setKey: SettingBoxKey.appFontWeight,
|
||||
onChanged: (_) => Get.updateMyAppTheme(),
|
||||
onTap: _showFontWeightDialog,
|
||||
),
|
||||
),
|
||||
NormalModel(
|
||||
title: '界面缩放',
|
||||
getSubtitle: () => '当前缩放比例:${Pref.uiScale.toStringAsFixed(2)}',
|
||||
@@ -107,21 +82,6 @@ List<SettingsModel> get styleSettings => [
|
||||
getSubtitle: () => '当前:${Pref.pageTransition.name}',
|
||||
onTap: _showTransitionDialog,
|
||||
),
|
||||
const SwitchModel(
|
||||
title: '优化平板导航栏',
|
||||
leading: Icon(Icons.auto_fix_high),
|
||||
setKey: SettingBoxKey.optTabletNav,
|
||||
defaultVal: true,
|
||||
needReboot: true,
|
||||
),
|
||||
const SwitchModel(
|
||||
title: 'MD3样式底栏',
|
||||
subtitle: 'Material You设计规范底栏,关闭可变窄',
|
||||
leading: Icon(Icons.design_services_outlined),
|
||||
setKey: SettingBoxKey.enableMYBar,
|
||||
defaultVal: true,
|
||||
needReboot: true,
|
||||
),
|
||||
const SwitchModel(
|
||||
title: '悬浮底栏',
|
||||
leading: Icon(MdiIcons.soundbar),
|
||||
@@ -254,30 +214,6 @@ List<SettingsModel> get styleSettings => [
|
||||
style: theme.textTheme.titleSmall,
|
||||
),
|
||||
),
|
||||
NormalModel(
|
||||
onTap: _showReduceColorDialog,
|
||||
title: '深色下图片颜色叠加',
|
||||
subtitle: '显示颜色=图片原色x所选颜色,大图查看不受影响',
|
||||
leading: const Icon(Icons.format_color_fill_outlined),
|
||||
getTrailing: (theme) => Container(
|
||||
width: 20,
|
||||
height: 20,
|
||||
decoration: BoxDecoration(
|
||||
color: Pref.reduceLuxColor ?? Colors.white,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
),
|
||||
),
|
||||
NormalModel(
|
||||
leading: const Icon(Icons.opacity_outlined),
|
||||
title: '气泡提示不透明度',
|
||||
subtitle: '自定义气泡提示(Toast)不透明度',
|
||||
getTrailing: (theme) => Text(
|
||||
CustomToast.toastOpacity.toStringAsFixed(1),
|
||||
style: theme.textTheme.titleSmall,
|
||||
),
|
||||
onTap: _showToastDialog,
|
||||
),
|
||||
NormalModel(
|
||||
onTap: _showThemeTypeDialog,
|
||||
leading: const Icon(Icons.flashlight_on_outlined),
|
||||
@@ -371,12 +307,6 @@ List<SettingsModel> get styleSettings => [
|
||||
defaultVal: false,
|
||||
onChanged: (value) => Get.find<MainController>().directExitOnBack = value,
|
||||
),
|
||||
if (Platform.isAndroid)
|
||||
NormalModel(
|
||||
onTap: (context, setState) => Get.toNamed('/displayModeSetting'),
|
||||
title: '屏幕帧率',
|
||||
leading: const Icon(Icons.autofps_select_outlined),
|
||||
),
|
||||
];
|
||||
|
||||
void _showQualityDialog({
|
||||
@@ -633,23 +563,6 @@ void _showSpringDialog(BuildContext context, _) {
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _showFontWeightDialog(BuildContext context) async {
|
||||
final res = await showDialog<double>(
|
||||
context: context,
|
||||
builder: (context) => SliderDialog(
|
||||
title: 'App字体字重',
|
||||
value: Pref.appFontWeight.toDouble() + 1,
|
||||
min: 1,
|
||||
max: FontWeight.values.length.toDouble(),
|
||||
divisions: FontWeight.values.length - 1,
|
||||
),
|
||||
);
|
||||
if (res != null) {
|
||||
await GStorage.setting.put(SettingBoxKey.appFontWeight, res.toInt() - 1);
|
||||
Get.updateMyAppTheme();
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _showTransitionDialog(
|
||||
BuildContext context,
|
||||
VoidCallback setState,
|
||||
@@ -795,79 +708,6 @@ Future<void> _showMsgUnReadDialog(
|
||||
}
|
||||
}
|
||||
|
||||
void _showReduceColorDialog(
|
||||
BuildContext context,
|
||||
VoidCallback setState,
|
||||
) {
|
||||
final reduceLuxColor = Pref.reduceLuxColor;
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
clipBehavior: Clip.hardEdge,
|
||||
contentPadding: const EdgeInsets.symmetric(vertical: 16),
|
||||
title: const Text('Color Picker'),
|
||||
content: SlideColorPicker(
|
||||
color: reduceLuxColor ?? Colors.white,
|
||||
onChanged: (Color? color) {
|
||||
if (color != null && color != reduceLuxColor) {
|
||||
if (color == Colors.white) {
|
||||
NetworkImgLayer.reduceLuxColor = null;
|
||||
GStorage.setting.delete(SettingBoxKey.reduceLuxColor);
|
||||
SmartDialog.showToast('设置成功');
|
||||
setState();
|
||||
} else {
|
||||
void onConfirm() {
|
||||
NetworkImgLayer.reduceLuxColor = color;
|
||||
GStorage.setting.put(
|
||||
SettingBoxKey.reduceLuxColor,
|
||||
color.toARGB32(),
|
||||
);
|
||||
SmartDialog.showToast('设置成功');
|
||||
setState();
|
||||
}
|
||||
|
||||
if (color.computeLuminance() < 0.2) {
|
||||
showConfirmDialog(
|
||||
context: context,
|
||||
title: Text(
|
||||
'确认使用#${(color.toARGB32() & 0xFFFFFF).toRadixString(16).toUpperCase().padLeft(6)}?',
|
||||
),
|
||||
content: const Text('所选颜色过于昏暗,可能会影响图片观看'),
|
||||
onConfirm: onConfirm,
|
||||
);
|
||||
} else {
|
||||
onConfirm();
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _showToastDialog(
|
||||
BuildContext context,
|
||||
VoidCallback setState,
|
||||
) async {
|
||||
final res = await showDialog<double>(
|
||||
context: context,
|
||||
builder: (context) => SliderDialog(
|
||||
title: 'Toast不透明度',
|
||||
value: CustomToast.toastOpacity,
|
||||
min: 0.0,
|
||||
max: 1.0,
|
||||
divisions: 10,
|
||||
),
|
||||
);
|
||||
if (res != null) {
|
||||
CustomToast.toastOpacity = res;
|
||||
await GStorage.setting.put(SettingBoxKey.defaultToastOp, res);
|
||||
SmartDialog.showToast('设置成功');
|
||||
setState();
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _showThemeTypeDialog(
|
||||
BuildContext context,
|
||||
VoidCallback setState,
|
||||
|
||||
@@ -14,7 +14,7 @@ import 'package:PiliPlus/utils/storage.dart';
|
||||
import 'package:PiliPlus/utils/storage_key.dart';
|
||||
import 'package:PiliPlus/utils/storage_pref.dart';
|
||||
import 'package:PiliPlus/utils/video_utils.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/foundation.dart' show kDebugMode;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart' show FilteringTextInputFormatter;
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
|
||||
Reference in New Issue
Block a user