mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-21 17:46:24 +08:00
feat: 调整设置,支持导入导出,代码优化
This commit is contained in:
@@ -21,7 +21,6 @@ class ExtraSetting extends StatefulWidget {
|
||||
class _ExtraSettingState extends State<ExtraSetting> {
|
||||
Box setting = GStrorage.setting;
|
||||
final SettingController settingController = Get.put(SettingController());
|
||||
static Box localCache = GStrorage.localCache;
|
||||
late dynamic defaultReplySort;
|
||||
late dynamic defaultDynamicType;
|
||||
late dynamic enableSystemProxy;
|
||||
@@ -45,9 +44,9 @@ class _ExtraSettingState extends State<ExtraSetting> {
|
||||
enableSystemProxy =
|
||||
setting.get(SettingBoxKey.enableSystemProxy, defaultValue: false);
|
||||
defaultSystemProxyHost =
|
||||
localCache.get(LocalCacheKey.systemProxyHost, defaultValue: '');
|
||||
setting.get(SettingBoxKey.systemProxyHost, defaultValue: '');
|
||||
defaultSystemProxyPort =
|
||||
localCache.get(LocalCacheKey.systemProxyPort, defaultValue: '');
|
||||
setting.get(SettingBoxKey.systemProxyPort, defaultValue: '');
|
||||
}
|
||||
|
||||
// 设置代理
|
||||
@@ -111,8 +110,8 @@ class _ExtraSettingState extends State<ExtraSetting> {
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
localCache.put(LocalCacheKey.systemProxyHost, systemProxyHost);
|
||||
localCache.put(LocalCacheKey.systemProxyPort, systemProxyPort);
|
||||
setting.put(SettingBoxKey.systemProxyHost, systemProxyHost);
|
||||
setting.put(SettingBoxKey.systemProxyPort, systemProxyPort);
|
||||
SmartDialog.dismiss();
|
||||
// Request.dio;
|
||||
},
|
||||
@@ -143,9 +142,10 @@ class _ExtraSettingState extends State<ExtraSetting> {
|
||||
body: ListView(
|
||||
children: [
|
||||
Obx(
|
||||
() => ListTile(
|
||||
() => ListTile(
|
||||
enableFeedback: true,
|
||||
onTap: () => settingController.onOpenFeedBack(),
|
||||
leading: const Icon(Icons.vibration_outlined),
|
||||
title: Text('震动反馈', style: titleStyle),
|
||||
subtitle: Text('请确定手机设置中已开启震动反馈', style: subTitleStyle),
|
||||
trailing: Transform.scale(
|
||||
@@ -153,13 +153,13 @@ class _ExtraSettingState extends State<ExtraSetting> {
|
||||
scale: 0.8,
|
||||
child: Switch(
|
||||
thumbIcon: MaterialStateProperty.resolveWith<Icon?>(
|
||||
(Set<MaterialState> states) {
|
||||
if (states.isNotEmpty &&
|
||||
states.first == MaterialState.selected) {
|
||||
return const Icon(Icons.done);
|
||||
}
|
||||
return null; // All other states will use the default thumbIcon.
|
||||
}),
|
||||
(Set<MaterialState> states) {
|
||||
if (states.isNotEmpty &&
|
||||
states.first == MaterialState.selected) {
|
||||
return const Icon(Icons.done);
|
||||
}
|
||||
return null; // All other states will use the default thumbIcon.
|
||||
}),
|
||||
value: settingController.feedBackEnable.value,
|
||||
onChanged: (value) => settingController.onOpenFeedBack()),
|
||||
),
|
||||
@@ -168,12 +168,14 @@ class _ExtraSettingState extends State<ExtraSetting> {
|
||||
const SetSwitchItem(
|
||||
title: '大家都在搜',
|
||||
subTitle: '是否展示「大家都在搜」',
|
||||
leading: Icon(Icons.data_thresholding_outlined),
|
||||
setKey: SettingBoxKey.enableHotKey,
|
||||
defaultVal: true,
|
||||
),
|
||||
SetSwitchItem(
|
||||
title: '搜索默认词',
|
||||
subTitle: '是否展示搜索框默认词',
|
||||
leading: const Icon(Icons.whatshot_outlined),
|
||||
setKey: SettingBoxKey.enableSearchWord,
|
||||
defaultVal: true,
|
||||
callFn: (val) {
|
||||
@@ -183,30 +185,35 @@ class _ExtraSettingState extends State<ExtraSetting> {
|
||||
const SetSwitchItem(
|
||||
title: '快速收藏',
|
||||
subTitle: '点按收藏至默认,长按选择文件夹',
|
||||
leading: Icon(Icons.bookmark_add_outlined),
|
||||
setKey: SettingBoxKey.enableQuickFav,
|
||||
defaultVal: false,
|
||||
),
|
||||
const SetSwitchItem(
|
||||
title: '评论区搜索关键词',
|
||||
subTitle: '展示评论区搜索关键词',
|
||||
leading: Icon(Icons.search_outlined),
|
||||
setKey: SettingBoxKey.enableWordRe,
|
||||
defaultVal: false,
|
||||
),
|
||||
const SetSwitchItem(
|
||||
title: '启用ai总结',
|
||||
subTitle: '视频详情页开启ai总结',
|
||||
leading: Icon(Icons.engineering_outlined),
|
||||
setKey: SettingBoxKey.enableAi,
|
||||
defaultVal: true,
|
||||
),
|
||||
const SetSwitchItem(
|
||||
title: '消息页禁用“收到的赞”功能',
|
||||
subTitle: '禁止打开入口,降低网络社交依赖',
|
||||
leading: Icon(Icons.beach_access_outlined),
|
||||
setKey: SettingBoxKey.disableLikeMsg,
|
||||
defaultVal: false,
|
||||
),
|
||||
ListTile(
|
||||
dense: false,
|
||||
title: Text('评论展示', style: titleStyle),
|
||||
leading: const Icon(Icons.whatshot_outlined),
|
||||
subtitle: Text(
|
||||
'当前优先展示「${ReplySortType.values[defaultReplySort].titles}」',
|
||||
style: subTitleStyle,
|
||||
@@ -233,6 +240,7 @@ class _ExtraSettingState extends State<ExtraSetting> {
|
||||
ListTile(
|
||||
dense: false,
|
||||
title: Text('动态展示', style: titleStyle),
|
||||
leading: const Icon(Icons.dynamic_feed_outlined),
|
||||
subtitle: Text(
|
||||
'当前优先展示「${DynamicsType.values[defaultDynamicType].labels}」',
|
||||
style: subTitleStyle,
|
||||
@@ -259,6 +267,7 @@ class _ExtraSettingState extends State<ExtraSetting> {
|
||||
ListTile(
|
||||
enableFeedback: true,
|
||||
onTap: () => twoFADialog(),
|
||||
leading: const Icon(Icons.airplane_ticket_outlined),
|
||||
title: Text('设置代理', style: titleStyle),
|
||||
subtitle: Text('设置代理 host:port', style: subTitleStyle),
|
||||
trailing: Transform.scale(
|
||||
@@ -287,12 +296,14 @@ class _ExtraSettingState extends State<ExtraSetting> {
|
||||
const SetSwitchItem(
|
||||
title: '自动清除缓存',
|
||||
subTitle: '每次启动时清除缓存',
|
||||
leading: Icon(Icons.auto_delete_outlined),
|
||||
setKey: SettingBoxKey.autoClearCache,
|
||||
defaultVal: false,
|
||||
defaultVal: true,
|
||||
),
|
||||
const SetSwitchItem(
|
||||
title: '检查更新',
|
||||
subTitle: '每次启动时检查是否需要更新',
|
||||
leading: Icon(Icons.system_update_alt_outlined),
|
||||
setKey: SettingBoxKey.autoUpdate,
|
||||
defaultVal: false,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user