mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-23 10:36:24 +08:00
feat: search settings item
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -1,13 +1,19 @@
|
||||
import 'package:PiliPalaX/pages/main/controller.dart';
|
||||
import 'package:PiliPalaX/utils/extension.dart';
|
||||
import 'package:PiliPalaX/utils/login.dart';
|
||||
import 'package:PiliPalaX/utils/storage.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:PiliPalaX/pages/setting/index.dart';
|
||||
|
||||
import '../../http/init.dart';
|
||||
|
||||
class SettingPage extends StatelessWidget {
|
||||
const SettingPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final SettingController settingController = Get.put(SettingController());
|
||||
RxBool isLogin = GStorage.isLogin.obs;
|
||||
final TextStyle titleStyle = Theme.of(context).textTheme.titleMedium!;
|
||||
final TextStyle subTitleStyle = Theme.of(context)
|
||||
.textTheme
|
||||
@@ -17,16 +23,40 @@ class SettingPage extends StatelessWidget {
|
||||
appBar: AppBar(title: Text('设置')),
|
||||
body: ListView(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: InkWell(
|
||||
onTap: () => Get.toNamed('/settingsSearch'),
|
||||
borderRadius: BorderRadius.circular(50),
|
||||
child: Ink(
|
||||
padding: const EdgeInsets.symmetric(vertical: 6),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(50),
|
||||
color: Theme.of(context).colorScheme.onInverseSurface,
|
||||
),
|
||||
child: Center(
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(
|
||||
size: MediaQuery.textScalerOf(context).scale(18),
|
||||
Icons.search,
|
||||
),
|
||||
const Text(' 搜索'),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
onTap: () => Get.toNamed('/privacySetting'),
|
||||
dense: false,
|
||||
leading: const Icon(Icons.privacy_tip_outlined),
|
||||
title: Text('隐私设置', style: titleStyle),
|
||||
subtitle: Text('黑名单、access_key刷新、无痕模式', style: subTitleStyle),
|
||||
),
|
||||
ListTile(
|
||||
onTap: () => Get.toNamed('/recommendSetting'),
|
||||
dense: false,
|
||||
leading: const Icon(Icons.explore_outlined),
|
||||
title: Text('推荐流设置', style: titleStyle),
|
||||
subtitle: Text('推荐来源(web/app)、刷新保留内容、过滤器', style: subTitleStyle),
|
||||
@@ -34,21 +64,18 @@ class SettingPage extends StatelessWidget {
|
||||
ListTile(
|
||||
onTap: () => Get.toNamed('/videoSetting'),
|
||||
leading: const Icon(Icons.video_settings_outlined),
|
||||
dense: false,
|
||||
title: Text('音视频设置', style: titleStyle),
|
||||
subtitle: Text('画质、音质、解码、缓冲、音频输出等', style: subTitleStyle),
|
||||
),
|
||||
ListTile(
|
||||
onTap: () => Get.toNamed('/playSetting'),
|
||||
leading: const Icon(Icons.touch_app_outlined),
|
||||
dense: false,
|
||||
title: Text('播放器设置', style: titleStyle),
|
||||
subtitle: Text('双击/长按、全屏、后台播放、弹幕、字幕、底部进度条等', style: subTitleStyle),
|
||||
),
|
||||
ListTile(
|
||||
onTap: () => Get.toNamed('/styleSetting'),
|
||||
leading: const Icon(Icons.style_outlined),
|
||||
dense: false,
|
||||
title: Text('外观设置', style: titleStyle),
|
||||
subtitle: Text('横屏适配(平板)、侧栏、列宽、首页、动态红点、主题、字号、图片、帧率等',
|
||||
style: subTitleStyle),
|
||||
@@ -56,36 +83,66 @@ class SettingPage extends StatelessWidget {
|
||||
ListTile(
|
||||
onTap: () => Get.toNamed('/extraSetting'),
|
||||
leading: const Icon(Icons.extension_outlined),
|
||||
dense: false,
|
||||
title: Text('其它设置', style: titleStyle),
|
||||
subtitle: Text('震动、搜索、收藏、ai、评论、动态、代理、更新检查等', style: subTitleStyle),
|
||||
),
|
||||
Obx(
|
||||
() => Visibility(
|
||||
visible: settingController.hiddenSettingUnlocked.value,
|
||||
child: ListTile(
|
||||
leading: const Icon(Icons.developer_board_outlined),
|
||||
onTap: () => Get.toNamed('/hiddenSetting'),
|
||||
dense: false,
|
||||
title: Text('开发人员选项', style: titleStyle),
|
||||
),
|
||||
),
|
||||
),
|
||||
Obx(
|
||||
() => Visibility(
|
||||
visible: settingController.userLogin.value,
|
||||
child: ListTile(
|
||||
leading: const Icon(Icons.logout_outlined),
|
||||
onTap: () => settingController.loginOut(context),
|
||||
dense: false,
|
||||
title: Text('退出登录', style: titleStyle),
|
||||
),
|
||||
),
|
||||
() => isLogin.value.not
|
||||
? const SizedBox.shrink()
|
||||
: ListTile(
|
||||
leading: const Icon(Icons.logout_outlined),
|
||||
onTap: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return AlertDialog(
|
||||
title: const Text('提示'),
|
||||
content: const Text('确认要退出登录吗'),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: Get.back,
|
||||
child: Text(
|
||||
'点错了',
|
||||
style: TextStyle(
|
||||
color:
|
||||
Theme.of(context).colorScheme.outline,
|
||||
),
|
||||
),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
// 清空cookie
|
||||
await Request.cookieManager.cookieJar
|
||||
.deleteAll();
|
||||
await CookieManager().deleteAllCookies();
|
||||
Request.dio.options.headers['cookie'] = '';
|
||||
// 清空本地存储的用户标识
|
||||
GStorage.userInfo.put('userInfoCache', null);
|
||||
GStorage.localCache.put(
|
||||
LocalCacheKey.accessKey,
|
||||
{'mid': -1, 'value': '', 'refresh': ''});
|
||||
isLogin.value = false;
|
||||
if (Get.isRegistered<MainController>()) {
|
||||
MainController mainController =
|
||||
Get.find<MainController>();
|
||||
mainController.userLogin.value = false;
|
||||
}
|
||||
await LoginUtils.refreshLoginStatus(false);
|
||||
Get.back();
|
||||
},
|
||||
child: const Text('确认'),
|
||||
)
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
title: Text('退出登录', style: titleStyle),
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.info_outline),
|
||||
onTap: () => Get.toNamed('/about'),
|
||||
dense: false,
|
||||
title: Text('关于', style: titleStyle),
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user