From 35369273bd3920418479415b23da978e74d6f169 Mon Sep 17 00:00:00 2001 From: Imran Remtulla Date: Sat, 17 Sep 2022 14:39:38 -0400 Subject: [PATCH] Changed source order, started adding strechy titlebars --- lib/pages/apps.dart | 101 +++++++++++++++++------------ lib/providers/source_provider.dart | 4 +- 2 files changed, 61 insertions(+), 44 deletions(-) diff --git a/lib/pages/apps.dart b/lib/pages/apps.dart index 7ccacfd..29eb35b 100644 --- a/lib/pages/apps.dart +++ b/lib/pages/apps.dart @@ -49,47 +49,64 @@ class _AppsPageState extends State { }, icon: const Icon(Icons.update), label: const Text('Update All')), - body: Center( - child: appsProvider.loadingApps - ? const CircularProgressIndicator() - : appsProvider.apps.isEmpty - ? Text( - 'No Apps', - style: Theme.of(context).textTheme.headlineMedium, - ) - : RefreshIndicator( - onRefresh: () { - HapticFeedback.lightImpact(); - return appsProvider.checkUpdates(); - }, - child: ListView( - children: sortedApps - .map( - (e) => ListTile( - title: Text('${e.app.author}/${e.app.name}'), - subtitle: Text( - e.app.installedVersion ?? 'Not Installed'), - trailing: e.downloadProgress != null - ? Text( - 'Downloading - ${e.downloadProgress?.toInt()}%') - : (e.app.installedVersion != null && - e.app.installedVersion != - e.app.latestVersion - ? const Text('Update Available') - : null), - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - AppPage(appId: e.app.id)), - ); - }, - ), - ) - .toList(), - ), - ), - )); + body: RefreshIndicator( + onRefresh: () { + HapticFeedback.lightImpact(); + return appsProvider.checkUpdates(); + }, + child: CustomScrollView(slivers: [ + SliverAppBar( + pinned: true, + snap: false, + floating: false, + expandedHeight: 100, + backgroundColor: MaterialStateColor.resolveWith( + (states) => states.contains(MaterialState.scrolledUnder) + ? Theme.of(context).colorScheme.surface + : Theme.of(context).canvasColor, + ), + flexibleSpace: const FlexibleSpaceBar( + titlePadding: const EdgeInsets.only(bottom: 16.0, left: 20.0), + title: Text( + 'Apps', + style: TextStyle(color: Colors.black), + ), + ), + ), + if (appsProvider.loadingApps || appsProvider.apps.isEmpty) + SliverToBoxAdapter( + child: appsProvider.loadingApps + ? const CircularProgressIndicator() + : Text( + 'No Apps', + style: Theme.of(context).textTheme.headlineMedium, + )), + SliverList( + delegate: SliverChildBuilderDelegate( + (BuildContext context, int index) { + return ListTile( + title: Text( + '${sortedApps[index].app.author}/${sortedApps[index].app.name}'), + subtitle: Text(sortedApps[index].app.installedVersion ?? + 'Not Installed'), + trailing: sortedApps[index].downloadProgress != null + ? Text( + 'Downloading - ${sortedApps[index].downloadProgress?.toInt()}%') + : (sortedApps[index].app.installedVersion != null && + sortedApps[index].app.installedVersion != + sortedApps[index].app.latestVersion + ? const Text('Update Available') + : null), + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + AppPage(appId: sortedApps[index].app.id)), + ); + }, + ); + }, childCount: sortedApps.length)) + ]))); } } diff --git a/lib/providers/source_provider.dart b/lib/providers/source_provider.dart index 1a3a058..83e1d70 100644 --- a/lib/providers/source_provider.dart +++ b/lib/providers/source_provider.dart @@ -399,9 +399,9 @@ class SourceProvider { GitHub(), GitLab(), FDroid(), + IzzyOnDroid(), Mullvad(), - Signal(), - IzzyOnDroid() + Signal() ]; List massSources = [GitHubStars()];