From 9b99e2b30270efbec16cfb8998b9cb84cee47bd2 Mon Sep 17 00:00:00 2001 From: Imran Remtulla Date: Wed, 2 Nov 2022 20:07:46 -0400 Subject: [PATCH] Addresses #88, #89 --- lib/pages/app.dart | 1 + lib/pages/apps.dart | 24 +++++++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/lib/pages/app.dart b/lib/pages/app.dart index 2650f60a..960a27d8 100644 --- a/lib/pages/app.dart +++ b/lib/pages/app.dart @@ -63,6 +63,7 @@ class _AppPageState extends State { Image.memory( app!.installedInfo!.icon!, height: 150, + gaplessPlayback: true, ) ]) : Container(), diff --git a/lib/pages/apps.dart b/lib/pages/apps.dart index 08055195..9414bf35 100644 --- a/lib/pages/apps.dart +++ b/lib/pages/apps.dart @@ -23,6 +23,7 @@ class AppsPageState extends State { var updatesOnlyFilter = AppsFilter(includeUptodate: false, includeNonInstalled: false); Set selectedIds = {}; + DateTime? refreshingSince; clearSelected() { if (selectedIds.isNotEmpty) { @@ -137,10 +138,17 @@ class AppsPageState extends State { body: RefreshIndicator( onRefresh: () { HapticFeedback.lightImpact(); + setState(() { + refreshingSince = DateTime.now(); + }); return appsProvider.checkUpdates().catchError((e) { ScaffoldMessenger.of(context).showSnackBar( SnackBar(content: Text(e.toString())), ); + }).whenComplete(() { + setState(() { + refreshingSince = null; + }); }); }, child: CustomScrollView(slivers: [ @@ -157,6 +165,17 @@ class AppsPageState extends State { style: Theme.of(context).textTheme.headlineMedium, textAlign: TextAlign.center, ))), + if (refreshingSince != null) + SliverToBoxAdapter( + child: LinearProgressIndicator( + value: appsProvider.apps.values + .where((element) => !(element.app.lastUpdateCheck + ?.isBefore(refreshingSince!) ?? + true)) + .length / + appsProvider.apps.length, + ), + ), SliverList( delegate: SliverChildBuilderDelegate( (BuildContext context, int index) { @@ -168,7 +187,10 @@ class AppsPageState extends State { toggleAppSelected(sortedApps[index].app.id); }, leading: sortedApps[index].installedInfo != null - ? Image.memory(sortedApps[index].installedInfo!.icon!) + ? Image.memory( + sortedApps[index].installedInfo!.icon!, + gaplessPlayback: true, + ) : null, title: Text(sortedApps[index].installedInfo?.name ?? sortedApps[index].app.name),