diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts index 5a8ba661..25b588a4 100644 --- a/android/app/build.gradle.kts +++ b/android/app/build.gradle.kts @@ -1,7 +1,5 @@ import java.io.FileInputStream import java.util.Properties -import com.android.build.api.variant.FilterConfiguration.FilterType.* -import com.android.build.gradle.internal.api.ApkVariantOutputImpl plugins { id("com.android.application") @@ -133,7 +131,7 @@ androidComponents { onVariants { variant -> variant.outputs.forEach { output -> val abiFilter = output.filters.find { - it.filterType == com.android.build.api.variant.VariantOutputConfiguration.FilterType.ABI + it.filterType.name == "ABI" } val abiVersionCode = abiFilter?.identifier?.let { abiCodes[it] } diff --git a/lib/pages/apps.dart b/lib/pages/apps.dart index 967ee6fa..099de410 100644 --- a/lib/pages/apps.dart +++ b/lib/pages/apps.dart @@ -1,5 +1,6 @@ import 'package:animations/animations.dart'; import 'dart:convert'; +import 'dart:math' as math; import 'package:flutter/material.dart'; import 'package:easy_localization/easy_localization.dart'; @@ -178,30 +179,33 @@ class AppsPageState extends State { var sourceProvider = SourceProvider(); + Future> refresh() async { + HapticFeedback.lightImpact(); + if (!mounted) return []; + + setState(() { + refreshingSince = DateTime.now(); + }); + + try { + return await context.read().checkUpdates(); + } catch (e) { + showError(e is Map ? e['errors'] : e, context); + return []; + } finally { + if (!mounted) return; + setState(() { + refreshingSince = null; + }); + } + } + @override Widget build(BuildContext context) { var appsProvider = context.watch(); var settingsProvider = context.watch(); var listedApps = appsProvider.getAppValues().toList(); - refresh() { - HapticFeedback.lightImpact(); - setState(() { - refreshingSince = DateTime.now(); - }); - return appsProvider - .checkUpdates() - .catchError((e) { - showError(e is Map ? e['errors'] : e, context); - return []; - }) - .whenComplete(() { - setState(() { - refreshingSince = null; - }); - }); - } - if (!appsProvider.loadingApps && appsProvider.apps.isNotEmpty && settingsProvider.checkJustStarted() && @@ -981,25 +985,19 @@ class AppsPageState extends State { borderRadius: BorderRadius.circular(12), color: Colors.black45, ), - const SizedBox(height: 16), - ], - ), - if (listedApps[index].downloadProgress != null) - Positioned.fill( - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.black45, - ), - child: Center( - child: CircularProgressIndicator( - value: listedApps[index].downloadProgress! >= 0 - ? listedApps[index].downloadProgress! / 100 - : null, - ), - ), + child: Builder( + builder: (_) { + final progress = listedApps[index].downloadProgress; + if (progress == null) return const SizedBox.shrink(); + return Center( + child: CircularProgressIndicator( + value: progress >= 0 ? progress / 100 : null, + ), + ); + }, ), - ), + ), + ), ), ); diff --git a/lib/pages/import_export.dart b/lib/pages/import_export.dart index 723ecdd1..4ceb9873 100644 --- a/lib/pages/import_export.dart +++ b/lib/pages/import_export.dart @@ -530,7 +530,7 @@ class _ImportExportPageState extends State { runSourceSearch(searchSource[0]); } }, - label: Text( + child: Text( tr( 'searchX', args: [lowerCaseIfEnglish(tr('source'))], @@ -927,7 +927,7 @@ class _SelectionModalState extends State { onPressed: () { Navigator.of(context).pop(); }, - label: Text(tr('cancel')), + child: Text(tr('cancel')), ), AppTextButton( onPressed: entrySelections.values.where((b) => b).isEmpty @@ -940,7 +940,7 @@ class _SelectionModalState extends State { .toList(), ); }, - label: Text( + child: Text( widget.onlyOneSelectionAllowed ? tr('pick') : tr(