mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
feat: 设置页面新增图标,改进注释,顺序调换
This commit is contained in:
@@ -8,6 +8,7 @@ import 'package:PiliPalaX/pages/setting/widgets/select_dialog.dart';
|
||||
import 'package:PiliPalaX/utils/storage.dart';
|
||||
|
||||
import '../home/index.dart';
|
||||
import 'controller.dart';
|
||||
import 'widgets/switch_item.dart';
|
||||
|
||||
class ExtraSetting extends StatefulWidget {
|
||||
@@ -19,6 +20,7 @@ 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;
|
||||
@@ -140,6 +142,29 @@ class _ExtraSettingState extends State<ExtraSetting> {
|
||||
),
|
||||
body: ListView(
|
||||
children: [
|
||||
Obx(
|
||||
() => ListTile(
|
||||
enableFeedback: true,
|
||||
onTap: () => settingController.onOpenFeedBack(),
|
||||
title: Text('震动反馈', style: titleStyle),
|
||||
subtitle: Text('请确定手机设置中已开启震动反馈', style: subTitleStyle),
|
||||
trailing: Transform.scale(
|
||||
alignment: Alignment.centerRight,
|
||||
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.
|
||||
}),
|
||||
value: settingController.feedBackEnable.value,
|
||||
onChanged: (value) => settingController.onOpenFeedBack()),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SetSwitchItem(
|
||||
title: '大家都在搜',
|
||||
subTitle: '是否展示「大家都在搜」',
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:auto_orientation/auto_orientation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:PiliPalaX/models/video/play/quality.dart';
|
||||
@@ -69,30 +67,42 @@ class _PlaySettingState extends State<PlaySetting> {
|
||||
),
|
||||
body: ListView(
|
||||
children: [
|
||||
const SetSwitchItem(
|
||||
title: '弹幕开关',
|
||||
subTitle: '设定弹幕是否默认显示',
|
||||
setKey: SettingBoxKey.enableShowDanmaku,
|
||||
defaultVal: false,
|
||||
),
|
||||
ListTile(
|
||||
dense: false,
|
||||
onTap: () => Get.toNamed('/playSpeedSet'),
|
||||
title: Text('倍速设置', style: titleStyle),
|
||||
subtitle: Text('设置视频播放速度', style: subTitleStyle),
|
||||
),
|
||||
const SetSwitchItem(
|
||||
title: '开启1080P',
|
||||
subTitle: '免登录查看1080P视频',
|
||||
setKey: SettingBoxKey.p1080,
|
||||
defaultVal: true,
|
||||
),
|
||||
const SetSwitchItem(
|
||||
title: 'CDN优化',
|
||||
subTitle: '使用优质CDN线路',
|
||||
setKey: SettingBoxKey.enableCDN,
|
||||
defaultVal: true,
|
||||
),
|
||||
const SetSwitchItem(
|
||||
title: '自动播放',
|
||||
subTitle: '进入详情页自动播放',
|
||||
setKey: SettingBoxKey.autoPlayEnable,
|
||||
defaultVal: true,
|
||||
),
|
||||
const SetSwitchItem(
|
||||
title: '双击快退/快进',
|
||||
subTitle: '左侧双击快退,右侧双击快进',
|
||||
setKey: SettingBoxKey.enableQuickDouble,
|
||||
defaultVal: true,
|
||||
),
|
||||
const SetSwitchItem(
|
||||
title: '自动全屏',
|
||||
subTitle: '视频开始播放时进入全屏',
|
||||
setKey: SettingBoxKey.enableAutoEnter,
|
||||
defaultVal: false,
|
||||
),
|
||||
const SetSwitchItem(
|
||||
title: '自动退出全屏',
|
||||
subTitle: '视频结束播放时退出全屏',
|
||||
setKey: SettingBoxKey.enableAutoExit,
|
||||
defaultVal: false,
|
||||
),
|
||||
const SetSwitchItem(
|
||||
title: '后台播放',
|
||||
subTitle: '进入后台时继续播放',
|
||||
@@ -101,62 +111,11 @@ class _PlaySettingState extends State<PlaySetting> {
|
||||
),
|
||||
if (Platform.isAndroid)
|
||||
const SetSwitchItem(
|
||||
title: '自动PiP播放',
|
||||
subTitle: '进入后台时画中画播放',
|
||||
title: '后台画中画',
|
||||
subTitle: '进入后台时以小窗形式(PiP)播放',
|
||||
setKey: SettingBoxKey.autoPiP,
|
||||
defaultVal: false,
|
||||
),
|
||||
const SetSwitchItem(
|
||||
title: '自动全屏',
|
||||
subTitle: '视频开始播放时进入全屏',
|
||||
setKey: SettingBoxKey.enableAutoEnter,
|
||||
defaultVal: false,
|
||||
),
|
||||
const SetSwitchItem(
|
||||
title: '自动退出',
|
||||
subTitle: '视频结束播放时退出全屏',
|
||||
setKey: SettingBoxKey.enableAutoExit,
|
||||
defaultVal: false,
|
||||
),
|
||||
SetSwitchItem(
|
||||
title: '横屏适配(测试)',
|
||||
subTitle: '开启该项在播放页启用横屏布局与逻辑',
|
||||
setKey: SettingBoxKey.horizontalScreen,
|
||||
defaultVal: false,
|
||||
callFn: (value) {
|
||||
if (value) {
|
||||
autoScreen();
|
||||
SmartDialog.showToast('已开启横屏适配');
|
||||
} else {
|
||||
AutoOrientation.portraitUpMode();
|
||||
SmartDialog.showToast('已关闭横屏适配');
|
||||
}
|
||||
}
|
||||
),
|
||||
const SetSwitchItem(
|
||||
title: '开启硬解',
|
||||
subTitle: '以较低功耗播放视频',
|
||||
setKey: SettingBoxKey.enableHA,
|
||||
defaultVal: true,
|
||||
),
|
||||
const SetSwitchItem(
|
||||
title: '观看人数',
|
||||
subTitle: '展示同时在看人数',
|
||||
setKey: SettingBoxKey.enableOnlineTotal,
|
||||
defaultVal: false,
|
||||
),
|
||||
const SetSwitchItem(
|
||||
title: '亮度记忆',
|
||||
subTitle: '返回时自动调整视频亮度',
|
||||
setKey: SettingBoxKey.enableAutoBrightness,
|
||||
defaultVal: false,
|
||||
),
|
||||
const SetSwitchItem(
|
||||
title: '双击快退/快进',
|
||||
subTitle: '左侧双击快退,右侧双击快进',
|
||||
setKey: SettingBoxKey.enableQuickDouble,
|
||||
defaultVal: true,
|
||||
),
|
||||
const SetSwitchItem(
|
||||
title: '全屏手势反向',
|
||||
subTitle: '默认播放器中部向上滑动进入全屏,向下退出\n开启后向下全屏,向上退出',
|
||||
@@ -164,9 +123,9 @@ class _PlaySettingState extends State<PlaySetting> {
|
||||
defaultVal: false,
|
||||
),
|
||||
const SetSwitchItem(
|
||||
title: '弹幕开关',
|
||||
subTitle: '展示弹幕',
|
||||
setKey: SettingBoxKey.enableShowDanmaku,
|
||||
title: '观看人数',
|
||||
subTitle: '展示同时在看人数',
|
||||
setKey: SettingBoxKey.enableOnlineTotal,
|
||||
defaultVal: false,
|
||||
),
|
||||
ListTile(
|
||||
@@ -247,6 +206,30 @@ class _PlaySettingState extends State<PlaySetting> {
|
||||
}
|
||||
},
|
||||
),
|
||||
const SetSwitchItem(
|
||||
title: '开启硬解',
|
||||
subTitle: '以较低功耗播放视频',
|
||||
setKey: SettingBoxKey.enableHA,
|
||||
defaultVal: true,
|
||||
),
|
||||
const SetSwitchItem(
|
||||
title: '亮度记忆',
|
||||
subTitle: '返回时自动调整视频亮度',
|
||||
setKey: SettingBoxKey.enableAutoBrightness,
|
||||
defaultVal: false,
|
||||
),
|
||||
const SetSwitchItem(
|
||||
title: '免登录1080P',
|
||||
subTitle: '免登录查看1080P视频',
|
||||
setKey: SettingBoxKey.p1080,
|
||||
defaultVal: true,
|
||||
),
|
||||
const SetSwitchItem(
|
||||
title: 'CDN优化',
|
||||
subTitle: '使用优质CDN线路',
|
||||
setKey: SettingBoxKey.enableCDN,
|
||||
defaultVal: true,
|
||||
),
|
||||
ListTile(
|
||||
dense: false,
|
||||
title: Text('默认全屏方式', style: titleStyle),
|
||||
|
||||
@@ -66,6 +66,9 @@ class _PrivacySettingState extends State<PrivacySetting> {
|
||||
},
|
||||
dense: false,
|
||||
title: Text('刷新access_key', style: titleStyle),
|
||||
subtitle: Text(
|
||||
'access_key是app端的用户凭证,用于推荐接口。刷新将使用cookie请求新的access_key,小概率导致其他设备下线。若发现app端推荐内容不是个性化内容,可尝试刷新',
|
||||
style: subTitleStyle),
|
||||
),
|
||||
ListTile(
|
||||
onTap: () {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:auto_orientation/auto_orientation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
@@ -12,6 +13,7 @@ import 'package:PiliPalaX/utils/global_data.dart';
|
||||
import 'package:PiliPalaX/utils/storage.dart';
|
||||
|
||||
import '../../models/common/dynamic_badge_mode.dart';
|
||||
import '../../plugin/pl_player/utils/fullscreen.dart';
|
||||
import 'controller.dart';
|
||||
import 'widgets/switch_item.dart';
|
||||
|
||||
@@ -60,29 +62,20 @@ class _StyleSettingState extends State<StyleSetting> {
|
||||
),
|
||||
body: ListView(
|
||||
children: [
|
||||
Obx(
|
||||
() => ListTile(
|
||||
enableFeedback: true,
|
||||
onTap: () => settingController.onOpenFeedBack(),
|
||||
title: const Text('震动反馈'),
|
||||
subtitle: Text('请确定手机设置中已开启震动反馈', style: subTitleStyle),
|
||||
trailing: Transform.scale(
|
||||
alignment: Alignment.centerRight,
|
||||
scale: 0.8,
|
||||
child: Switch(
|
||||
thumbIcon: MaterialStateProperty.resolveWith<Icon?>(
|
||||
(Set<MaterialState> states) {
|
||||
if (states.isNotEmpty &&
|
||||
states.first == MaterialState.selected) {
|
||||
return const Icon(Icons.done);
|
||||
SetSwitchItem(
|
||||
title: '横屏适配',
|
||||
subTitle: '开启该项启用横屏布局与逻辑(测试)',
|
||||
setKey: SettingBoxKey.horizontalScreen,
|
||||
defaultVal: false,
|
||||
callFn: (value) {
|
||||
if (value) {
|
||||
autoScreen();
|
||||
SmartDialog.showToast('已开启横屏适配');
|
||||
} else {
|
||||
AutoOrientation.portraitUpMode();
|
||||
SmartDialog.showToast('已关闭横屏适配');
|
||||
}
|
||||
return null; // All other states will use the default thumbIcon.
|
||||
}),
|
||||
value: settingController.feedBackEnable.value,
|
||||
onChanged: (value) => settingController.onOpenFeedBack()),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SetSwitchItem(
|
||||
title: 'MD3样式底栏',
|
||||
subTitle: '符合Material You设计规范的底栏,关闭可使底栏变窄',
|
||||
@@ -104,7 +97,7 @@ class _StyleSettingState extends State<StyleSetting> {
|
||||
needReboot: true,
|
||||
),
|
||||
const SetSwitchItem(
|
||||
title: '首页底栏背景渐变',
|
||||
title: '首页背景渐变',
|
||||
setKey: SettingBoxKey.enableGradientBg,
|
||||
defaultVal: true,
|
||||
needReboot: true,
|
||||
@@ -132,9 +125,10 @@ class _StyleSettingState extends State<StyleSetting> {
|
||||
}
|
||||
},
|
||||
dense: false,
|
||||
title: Text('最大列宽度(dp)', style: titleStyle),
|
||||
title: Text('最大列宽(dp)基准', style: titleStyle),
|
||||
subtitle: Text(
|
||||
'当前最大列宽度:${maxRowWidth.toInt()}dp,屏幕宽度:${MediaQuery.of(context).size.width.toPrecision(2)}dp,',
|
||||
'当前:${maxRowWidth.toInt()}dp,屏幕宽度:${MediaQuery.of(context).size.width.toPrecision(2)}dp。'
|
||||
'该值决定列表在不同屏宽下的列数,部分列表会根据系数折算宽度',
|
||||
style: subTitleStyle,
|
||||
),
|
||||
),
|
||||
@@ -278,7 +272,8 @@ class _StyleSettingState extends State<StyleSetting> {
|
||||
ListTile(
|
||||
dense: false,
|
||||
onTap: () => Get.toNamed('/tabbarSetting'),
|
||||
title: Text('首页tabbar', style: titleStyle),
|
||||
title: Text('首页标签页', style: titleStyle),
|
||||
subtitle: Text('删除或调换首页标签页', style: subTitleStyle),
|
||||
),
|
||||
if (Platform.isAndroid)
|
||||
ListTile(
|
||||
|
||||
@@ -8,6 +8,10 @@ class SettingPage extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final SettingController settingController = Get.put(SettingController());
|
||||
final TextStyle subTitleStyle = Theme.of(context)
|
||||
.textTheme
|
||||
.labelMedium!
|
||||
.copyWith(color: Theme.of(context).colorScheme.outline);
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
centerTitle: false,
|
||||
@@ -22,32 +26,43 @@ class SettingPage extends StatelessWidget {
|
||||
ListTile(
|
||||
onTap: () => Get.toNamed('/privacySetting'),
|
||||
dense: false,
|
||||
leading: const Icon(Icons.privacy_tip_outlined),
|
||||
title: const Text('隐私设置'),
|
||||
subtitle: Text('黑名单、access_key刷新、无痕模式', style: subTitleStyle),
|
||||
),
|
||||
ListTile(
|
||||
onTap: () => Get.toNamed('/recommendSetting'),
|
||||
dense: false,
|
||||
title: const Text('推荐设置'),
|
||||
leading: const Icon(Icons.grid_view_outlined),
|
||||
title: const Text('推荐流设置'),
|
||||
subtitle: Text('推荐来源(web/app)、刷新保留内容、过滤器', style: subTitleStyle),
|
||||
),
|
||||
ListTile(
|
||||
onTap: () => Get.toNamed('/playSetting'),
|
||||
leading: const Icon(Icons.play_arrow_outlined),
|
||||
dense: false,
|
||||
title: const Text('播放设置'),
|
||||
subtitle: Text('弹幕、播放器行为与手势、画质、音质、解码、底部进度条等', style: subTitleStyle),
|
||||
),
|
||||
ListTile(
|
||||
onTap: () => Get.toNamed('/styleSetting'),
|
||||
leading: const Icon(Icons.style_outlined),
|
||||
dense: false,
|
||||
title: const Text('外观设置'),
|
||||
subtitle: Text('横屏适配、列宽、首页、主题、字号、图片、动态红点、帧率等', style: subTitleStyle),
|
||||
),
|
||||
ListTile(
|
||||
onTap: () => Get.toNamed('/extraSetting'),
|
||||
leading: const Icon(Icons.extension_outlined),
|
||||
dense: false,
|
||||
title: const Text('其他设置'),
|
||||
subtitle: Text('震动、搜索、收藏、ai、评论、动态、代理、更新检查等', style: subTitleStyle),
|
||||
),
|
||||
Obx(
|
||||
() => Visibility(
|
||||
visible: settingController.hiddenSettingUnlocked.value,
|
||||
child: ListTile(
|
||||
leading: const Icon(Icons.developer_mode_outlined),
|
||||
onTap: () => Get.toNamed('/hiddenSetting'),
|
||||
dense: false,
|
||||
title: const Text('开发人员选项'),
|
||||
@@ -58,6 +73,7 @@ class SettingPage extends StatelessWidget {
|
||||
() => Visibility(
|
||||
visible: settingController.userLogin.value,
|
||||
child: ListTile(
|
||||
leading: const Icon(Icons.logout_outlined),
|
||||
onTap: () => settingController.loginOut(),
|
||||
dense: false,
|
||||
title: const Text('退出登录'),
|
||||
@@ -65,6 +81,7 @@ class SettingPage extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.info_outline),
|
||||
onTap: () => Get.toNamed('/about'),
|
||||
dense: false,
|
||||
title: const Text('关于'),
|
||||
|
||||
Reference in New Issue
Block a user