mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
无痕模式补充设置,美化snackbar
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'package:dio/dio.dart';
|
import 'package:dio/dio.dart';
|
||||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
// import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
import '../pages/mine/controller.dart';
|
import '../pages/mine/controller.dart';
|
||||||
import 'api.dart';
|
import 'api.dart';
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ class MineController extends GetxController {
|
|||||||
|
|
||||||
themeType.value = ThemeType.values[setting.get(SettingBoxKey.themeMode,
|
themeType.value = ThemeType.values[setting.get(SettingBoxKey.themeMode,
|
||||||
defaultValue: ThemeType.system.code)];
|
defaultValue: ThemeType.system.code)];
|
||||||
|
anonymity = setting.get(SettingBoxKey.anonymity, defaultValue: false);
|
||||||
}
|
}
|
||||||
|
|
||||||
onLogin() async {
|
onLogin() async {
|
||||||
@@ -94,26 +95,61 @@ class MineController extends GetxController {
|
|||||||
if (anonymity) {
|
if (anonymity) {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
SnackBar(
|
SnackBar(
|
||||||
content: const Text('\n已进入无痕模式\n\n'
|
content: Column(children: <Widget>[
|
||||||
'* 搜索、观看视频或直播均不携带Cookie与CSRF,'
|
const Row(
|
||||||
'不产生查询或播放记录\n'
|
children: <Widget>[
|
||||||
'点赞等其它操作不受影响\n\n'
|
Icon(
|
||||||
'仅本次启动有效,可随时退出\n\n'
|
Icons.check,
|
||||||
'*可在隐私设置了解更多'),
|
color: Colors.green,
|
||||||
duration: const Duration(seconds: 1),
|
|
||||||
action: SnackBarAction(
|
|
||||||
label: '设为永久',
|
|
||||||
onPressed: () {
|
|
||||||
SmartDialog.showToast('暂不支持');
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
SizedBox(width: 10),
|
||||||
|
Text('已进入无痕模式', style: TextStyle(fontSize: 15, height: 1.5))
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
const Text(
|
||||||
|
'搜索、观看视频/直播不携带Cookie与CSRF\n'
|
||||||
|
'不产生查询或播放记录\n'
|
||||||
|
'点赞等其它操作不受影响\n'
|
||||||
|
'(前往隐私设置了解详情)',
|
||||||
|
style: TextStyle(fontSize: 12.5, height: 1.5)),
|
||||||
|
Row(children: [
|
||||||
|
TextButton(
|
||||||
|
style: ButtonStyle(
|
||||||
|
foregroundColor: MaterialStateProperty.resolveWith((states) {
|
||||||
|
return Theme.of(context).snackBarTheme.actionTextColor;
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
GStrorage.setting.put(SettingBoxKey.anonymity, true);
|
||||||
|
anonymity = true;
|
||||||
|
SmartDialog.showToast('已设为永久无痕模式');
|
||||||
|
},
|
||||||
|
child: const Text('保存为永久')),
|
||||||
|
const SizedBox(width: 10),
|
||||||
|
TextButton(
|
||||||
|
style: ButtonStyle(
|
||||||
|
foregroundColor: MaterialStateProperty.resolveWith((states) {
|
||||||
|
return Theme.of(context).snackBarTheme.actionTextColor;
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
GStrorage.setting.put(SettingBoxKey.anonymity, false);
|
||||||
|
anonymity = true;
|
||||||
|
SmartDialog.showToast('已设为临时无痕模式');
|
||||||
|
},
|
||||||
|
child: const Text('仅本次(默认)'))
|
||||||
|
])
|
||||||
|
]),
|
||||||
|
duration: const Duration(seconds: 2),
|
||||||
showCloseIcon: true,
|
showCloseIcon: true,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
GStrorage.setting.put(SettingBoxKey.anonymity, false);
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
const SnackBar(
|
const SnackBar(
|
||||||
content: Text('【已退出无痕模式】'),
|
content: Text('已退出无痕模式'),
|
||||||
duration: Duration(seconds: 1),
|
duration: Duration(seconds: 1),
|
||||||
// action: SnackBarAction(
|
// action: SnackBarAction(
|
||||||
// label: '确认',
|
// label: '确认',
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import 'package:pilipala/http/interceptor_anonymity.dart';
|
|||||||
import 'package:pilipala/http/member.dart';
|
import 'package:pilipala/http/member.dart';
|
||||||
import 'package:pilipala/utils/storage.dart';
|
import 'package:pilipala/utils/storage.dart';
|
||||||
|
|
||||||
|
import '../mine/controller.dart';
|
||||||
|
|
||||||
class PrivacySetting extends StatefulWidget {
|
class PrivacySetting extends StatefulWidget {
|
||||||
const PrivacySetting({super.key});
|
const PrivacySetting({super.key});
|
||||||
|
|
||||||
@@ -65,13 +67,28 @@ class _PrivacySettingState extends State<PrivacySetting> {
|
|||||||
dense: false,
|
dense: false,
|
||||||
title: Text('刷新access_key', style: titleStyle),
|
title: Text('刷新access_key', style: titleStyle),
|
||||||
),
|
),
|
||||||
|
ListTile(
|
||||||
|
onTap: () {
|
||||||
|
MineController.onChangeAnonymity(context);
|
||||||
|
setState(() {});
|
||||||
|
},
|
||||||
|
dense: false,
|
||||||
|
title: Text(MineController.anonymity ? '退出无痕模式' : '进入无痕模式',
|
||||||
|
style: titleStyle),
|
||||||
|
subtitle: Text(
|
||||||
|
MineController.anonymity
|
||||||
|
? '已进入无痕模式,搜索、观看视频/直播不携带Cookie与CSRF,其余操作不受影响'
|
||||||
|
: '未开启无痕模式,将使用账户信息提供完整服务',
|
||||||
|
style: subTitleStyle,
|
||||||
|
)),
|
||||||
ListTile(
|
ListTile(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
SmartDialog.show(
|
SmartDialog.show(
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
title: const Text('查看详情'),
|
title: const Text('查看详情'),
|
||||||
content: Text(AnonymityInterceptor.anonymityList.join('\n')),
|
content:
|
||||||
|
Text(AnonymityInterceptor.anonymityList.join('\n')),
|
||||||
actions: [
|
actions: [
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
|
|||||||
@@ -119,6 +119,7 @@ class SettingBoxKey {
|
|||||||
|
|
||||||
/// 隐私
|
/// 隐私
|
||||||
blackMidsList = 'blackMidsList',
|
blackMidsList = 'blackMidsList',
|
||||||
|
anonymity = 'anonymity',
|
||||||
|
|
||||||
/// 推荐
|
/// 推荐
|
||||||
enableRcmdDynamic = 'enableRcmdDynamic',
|
enableRcmdDynamic = 'enableRcmdDynamic',
|
||||||
|
|||||||
Reference in New Issue
Block a user