fix: servers batch del

This commit is contained in:
lollipopkit
2023-12-03 14:14:30 +08:00
parent 66d344c910
commit 7c2480f027

View File

@@ -905,30 +905,36 @@ class _SettingPageState extends State<SettingPage> {
title: Text(l10n.deleteServers), title: Text(l10n.deleteServers),
trailing: const Icon(Icons.delete_forever), trailing: const Icon(Icons.delete_forever),
onTap: () async { onTap: () async {
final all = Stores.server.box.keys.map(
(e) => TextButton(
onPressed: () => context.showRoundDialog(
title: Text(l10n.attention),
child: Text(l10n.askContinue(
'${l10n.delete} ${l10n.server}($e)',
)),
actions: [
TextButton(
onPressed: () => Pros.server.delServer(e),
child: Text(l10n.ok),
)
],
),
child: Text(e),
),
);
context.showRoundDialog<List<String>>( context.showRoundDialog<List<String>>(
title: Text(l10n.choose), title: Text(l10n.choose),
child: SingleChildScrollView( child: SingleChildScrollView(
child: Column( child: StatefulBuilder(builder: (ctx, setState) {
mainAxisSize: MainAxisSize.min, final all = Stores.server.box.keys.map(
children: all.toList(), (e) => TextButton(
), onPressed: () => context.showRoundDialog(
title: Text(l10n.attention),
child: Text(l10n.askContinue(
'${l10n.delete} ${l10n.server}($e)',
)),
actions: [
TextButton(
onPressed: () {
Pros.server.delServer(e);
ctx.pop();
setState(() {});
},
child: Text(l10n.ok),
)
],
),
child: Text(e),
),
);
return Column(
mainAxisSize: MainAxisSize.min,
children: all.toList(),
);
}),
), ),
); );
}, },