- fix: same name snippet caused err
- fix: auto load servers from db after restoring
This commit is contained in:
lollipopkit
2023-09-24 14:51:51 +08:00
parent 5a9fd74470
commit 1194a87c76
9 changed files with 74 additions and 81 deletions

View File

@@ -100,42 +100,46 @@ class _SettingPageState extends State<SettingPage> {
appBar: CustomAppBar(
title: Text(l10n.setting),
actions: [
IconButton(
onPressed: () => context.showRoundDialog(
title: Text(l10n.attention),
child: Text(l10n.sureDelete(l10n.all)),
actions: [
TextButton(
onPressed: () {
_setting.box.deleteAll(_setting.box.keys);
context.pop();
context.showSnackBar(l10n.success);
},
child:
Text(l10n.ok, style: const TextStyle(color: Colors.red)),
),
],
Padding(
padding: const EdgeInsets.only(right: 17),
child: InkWell(
onTap: () => context.showRoundDialog(
title: Text(l10n.attention),
child: Text(l10n.sureDelete(l10n.all)),
actions: [
TextButton(
onPressed: () {
_setting.box.deleteAll(_setting.box.keys);
context.pop();
context.showSnackBar(l10n.success);
},
child: Text(l10n.ok,
style: const TextStyle(color: Colors.red)),
),
],
),
/// Only for debug, this will cause the app to crash
// onDoubleTap: () => context.showRoundDialog(
// title: Text(l10n.attention),
// child: Text(l10n.sureDelete(l10n.all)),
// actions: [
// TextButton(
// onPressed: () {
// Stores.docker.box.deleteFromDisk();
// Stores.server.box.deleteFromDisk();
// Stores.setting.box.deleteFromDisk();
// Stores.history.box.deleteFromDisk();
// Stores.snippet.box.deleteFromDisk();
// Stores.key.box.deleteFromDisk();
// exit(0);
// },
// child: Text(l10n.ok,
// style: const TextStyle(color: Colors.red)),
// ),
// ],
// ),
child: const Icon(Icons.delete),
),
// onDoubleTap: () => context.showRoundDialog(
// title: Text(l10n.attention),
// child: Text(l10n.sureDelete(l10n.all)),
// actions: [
// TextButton(
// onPressed: () {
// Stores.docker.box.deleteFromDisk();
// Stores.server.box.deleteFromDisk();
// Stores.setting.box.deleteFromDisk();
// Stores.history.box.deleteFromDisk();
// Stores.snippet.box.deleteFromDisk();
// Stores.key.box.deleteFromDisk();
// context.pop();
// context.showSnackBar(l10n.success);
// },
// child: Text(l10n.ok, style: const TextStyle(color: Colors.red)),
// ),
// ],
// ),
icon: const Icon(Icons.delete),
),
],
),