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,6 +905,10 @@ 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 {
context.showRoundDialog<List<String>>(
title: Text(l10n.choose),
child: SingleChildScrollView(
child: StatefulBuilder(builder: (ctx, setState) {
final all = Stores.server.box.keys.map( final all = Stores.server.box.keys.map(
(e) => TextButton( (e) => TextButton(
onPressed: () => context.showRoundDialog( onPressed: () => context.showRoundDialog(
@@ -914,7 +918,11 @@ class _SettingPageState extends State<SettingPage> {
)), )),
actions: [ actions: [
TextButton( TextButton(
onPressed: () => Pros.server.delServer(e), onPressed: () {
Pros.server.delServer(e);
ctx.pop();
setState(() {});
},
child: Text(l10n.ok), child: Text(l10n.ok),
) )
], ],
@@ -922,13 +930,11 @@ class _SettingPageState extends State<SettingPage> {
child: Text(e), child: Text(e),
), ),
); );
context.showRoundDialog<List<String>>( return Column(
title: Text(l10n.choose),
child: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: all.toList(), children: all.toList(),
), );
}),
), ),
); );
}, },