opt.: show loading dialog

This commit is contained in:
lollipopkit🏳️‍⚧️
2024-07-22 23:33:21 +08:00
parent 7a359588db
commit 41ec46f1d3
8 changed files with 86 additions and 80 deletions

View File

@@ -245,7 +245,7 @@ Future<void> _onPkg(BuildContext context, ServerPrivateInfo spi) async {
}
// Update pkg list
await context.showLoadingDialog(
final suc = await context.showLoadingDialog(
fn: () async {
final updateCmd = pkg.update;
if (updateCmd != null) {
@@ -258,6 +258,7 @@ Future<void> _onPkg(BuildContext context, ServerPrivateInfo spi) async {
},
barrierDismiss: true,
);
if (suc != true) return;
final listCmd = pkg.listUpdate;
if (listCmd == null) {
@@ -266,9 +267,14 @@ Future<void> _onPkg(BuildContext context, ServerPrivateInfo spi) async {
}
// Get upgrade list
final result = await context.showLoadingDialog(fn: () async {
return await client.run(listCmd).string;
});
final result = await context.showLoadingDialog(
fn: () => client.run(listCmd).string,
);
if (result == null || result.isEmpty) {
context.showSnackBar(l10n.noResult);
return;
}
final list = pkg.updateListRemoveUnused(result.split('\n'));
final upgradeable = list.map((e) => UpgradePkgInfo(e, pkg)).toList();
if (upgradeable.isEmpty) {