Skip to content

Commit

Permalink
Addresses #88, #89
Browse files Browse the repository at this point in the history
  • Loading branch information
Imran Remtulla committed Nov 3, 2022
1 parent e746ca8 commit 9b99e2b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/pages/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ class _AppPageState extends State<AppPage> {
Image.memory(
app!.installedInfo!.icon!,
height: 150,
gaplessPlayback: true,
)
])
: Container(),
Expand Down
24 changes: 23 additions & 1 deletion lib/pages/apps.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class AppsPageState extends State<AppsPage> {
var updatesOnlyFilter =
AppsFilter(includeUptodate: false, includeNonInstalled: false);
Set<String> selectedIds = {};
DateTime? refreshingSince;

clearSelected() {
if (selectedIds.isNotEmpty) {
Expand Down Expand Up @@ -137,10 +138,17 @@ class AppsPageState extends State<AppsPage> {
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: <Widget>[
Expand All @@ -157,6 +165,17 @@ class AppsPageState extends State<AppsPage> {
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) {
Expand All @@ -168,7 +187,10 @@ class AppsPageState extends State<AppsPage> {
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),
Expand Down

0 comments on commit 9b99e2b

Please sign in to comment.