mod: 无痕模式提示条替换为SmartDialog实现

This commit is contained in:
orz12
2024-04-22 20:12:38 +08:00
parent 42af6ec3f7
commit a3d623539a

View File

@@ -94,71 +94,99 @@ class MineController extends GetxController {
static onChangeAnonymity(BuildContext context) { static onChangeAnonymity(BuildContext context) {
anonymity = !anonymity; anonymity = !anonymity;
if (anonymity) { if (anonymity) {
ScaffoldMessenger.of(context).showSnackBar( SmartDialog.show(
SnackBar( clickMaskDismiss: false,
content: Column(children: <Widget>[ usePenetrate: true,
const Row( displayTime: const Duration(seconds: 2),
children: <Widget>[ alignment: Alignment.bottomCenter,
Icon( builder: (context) {
Icons.check, return ColoredBox(
color: Colors.green, color: Theme.of(context).colorScheme.secondaryContainer,
), child: Padding(
SizedBox(width: 10), padding:
Text('已进入无痕模式', style: TextStyle(fontSize: 15, height: 1.5)) const EdgeInsets.symmetric(vertical: 15, horizontal: 20),
], child:
), Column(mainAxisSize: MainAxisSize.min, children: <Widget>[
const SizedBox(height: 10), const Row(
const Text( children: <Widget>[
'搜索、观看视频/直播不携带Cookie与CSRF\n' Icon(
'不产生查询或播放记录\n' Icons.check,
'点赞等其它操作不受影响\n' color: Colors.green,
'(前往隐私设置了解详情)', ),
style: TextStyle(fontSize: 12.5, height: 1.5)), SizedBox(width: 10),
Row(children: [ Text('已进入无痕模式',
TextButton( style: TextStyle(fontSize: 15, height: 1.5))
style: ButtonStyle( ],
foregroundColor: MaterialStateProperty.resolveWith((states) { ),
return Theme.of(context).snackBarTheme.actionTextColor; const SizedBox(height: 10),
}), const Text(
), '搜索、观看视频/直播不携带Cookie与CSRF\n'
onPressed: () { '不产生查询或播放记录\n'
GStrorage.setting.put(SettingBoxKey.anonymity, true); '点赞等其它操作不受影响\n'
anonymity = true; '(前往隐私设置了解详情)',
SmartDialog.showToast('已设为永久无痕模式'); style: TextStyle(fontSize: 12.5, height: 1.5)),
}, Row(
child: const Text('保存为永久')), mainAxisAlignment: MainAxisAlignment.spaceEvenly,
const SizedBox(width: 10), children: [
TextButton( TextButton(
style: ButtonStyle( onPressed: () {
foregroundColor: MaterialStateProperty.resolveWith((states) { SmartDialog.dismiss();
return Theme.of(context).snackBarTheme.actionTextColor; GStrorage.setting
}), .put(SettingBoxKey.anonymity, true);
), anonymity = true;
onPressed: () { SmartDialog.showToast('已设为永久无痕模式');
GStrorage.setting.put(SettingBoxKey.anonymity, false); },
anonymity = true; child: Text(
SmartDialog.showToast('已设为临时无痕模式'); '保存为永久',
}, style: TextStyle(
child: const Text('仅本次(默认)')) color: Theme.of(context).colorScheme.primary,
]) ),
]), )),
duration: const Duration(seconds: 2), const SizedBox(width: 10),
showCloseIcon: true, TextButton(
), onPressed: () {
); SmartDialog.dismiss();
GStrorage.setting
.put(SettingBoxKey.anonymity, false);
anonymity = true;
SmartDialog.showToast('已设为临时无痕模式');
},
child: Text(
'仅本次(默认)',
style: TextStyle(
color: Theme.of(context).colorScheme.primary,
),
)),
]),
])),
// duration: const Duration(seconds: 2),
// showCloseIcon: true,
);
});
} else { } else {
GStrorage.setting.put(SettingBoxKey.anonymity, false); GStrorage.setting.put(SettingBoxKey.anonymity, false);
ScaffoldMessenger.of(context).showSnackBar( SmartDialog.show(
const SnackBar( clickMaskDismiss: false,
content: Text('已退出无痕模式'), usePenetrate: true,
duration: Duration(seconds: 1), displayTime: const Duration(seconds: 1),
// action: SnackBarAction( alignment: Alignment.bottomCenter,
// label: '确认', builder: (context) {
// onPressed: () {}, return ColoredBox(
// ), color: Theme.of(context).colorScheme.secondaryContainer,
showCloseIcon: true, child: const Padding(
), padding: EdgeInsets.symmetric(vertical: 15, horizontal: 20),
); child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Icon(
Icons.check,
color: Colors.green,
),
SizedBox(width: 10),
Text('已退出无痕模式'),
],
)));
});
} }
} }