From 68edf5b13eace85ab34d31217390184a9b5f60b7 Mon Sep 17 00:00:00 2001 From: franzap <_@franzap.com> Date: Wed, 13 Nov 2024 00:02:07 -0300 Subject: [PATCH] Improve UI of recommended apps --- lib/screens/app_detail_screen.dart | 3 +- lib/widgets/app_curation_container.dart | 1 + lib/widgets/install_alert_dialog.dart | 39 +++++++++++++------------ lib/widgets/wot_container.dart | 9 ++++-- 4 files changed, 30 insertions(+), 22 deletions(-) diff --git a/lib/screens/app_detail_screen.dart b/lib/screens/app_detail_screen.dart index 284a9b1..09d02e0 100644 --- a/lib/screens/app_detail_screen.dart +++ b/lib/screens/app_detail_screen.dart @@ -96,7 +96,8 @@ class AppDetailScreen extends HookConsumerWidget { Divider(height: 24), if (curatedBy.isNotEmpty) UsersRichText( - trailingText: ' recommended this app', + trailingText: + ' recommend${curatedBy.length == 1 ? 's' : ''} this app', users: curatedBy.toList(), ), if (curatedBy.isNotEmpty) Gap(20), diff --git a/lib/widgets/app_curation_container.dart b/lib/widgets/app_curation_container.dart index f1b177c..638d264 100644 --- a/lib/widgets/app_curation_container.dart +++ b/lib/widgets/app_curation_container.dart @@ -111,6 +111,7 @@ class AppCurationSetNotifier final appCurationSet = await future; final appsLocal = ref.apps.appAdapter.findWhereIdentifierInLocal(appCurationSet.appIds); + // TODO: Rethink this logic, if an app is missing it loops forever if (appsLocal.length < appCurationSet.appIds.length) { state = AsyncLoading(); state = await AsyncValue.guard(() async { diff --git a/lib/widgets/install_alert_dialog.dart b/lib/widgets/install_alert_dialog.dart index 0edb203..c0bf7b4 100644 --- a/lib/widgets/install_alert_dialog.dart +++ b/lib/widgets/install_alert_dialog.dart @@ -53,29 +53,30 @@ class InstallAlertDialog extends ConsumerWidget { minimal: true, labelText: 'Log in to view your own web of trust', ), + Gap(20), + if (app.latestMetadata?.urls.isNotEmpty ?? false) + RichText( + text: WidgetSpan( + child: Wrap( + crossAxisAlignment: WrapCrossAlignment.center, + children: [ + Text('This app will be downloaded from '), + Text( + Uri.parse(app.latestMetadata!.urls.first).host, + style: TextStyle( + fontWeight: FontWeight.bold, + decoration: TextDecoration.underline, + ), + ), + Text(' and verified.'), + ], + ), + ), + ), ], ), ), actions: [ - if (app.latestMetadata?.urls.isNotEmpty ?? false) - RichText( - text: WidgetSpan( - child: Wrap( - crossAxisAlignment: WrapCrossAlignment.center, - children: [ - Text('This app will be downloaded from '), - Text( - Uri.parse(app.latestMetadata!.urls.first).host, - style: TextStyle( - fontWeight: FontWeight.bold, - decoration: TextDecoration.underline, - ), - ), - Text(' and verified.'), - ], - ), - ), - ), Padding( padding: const EdgeInsets.symmetric(vertical: 10), child: TextButton( diff --git a/lib/widgets/wot_container.dart b/lib/widgets/wot_container.dart index 339c741..40c01e3 100644 --- a/lib/widgets/wot_container.dart +++ b/lib/widgets/wot_container.dart @@ -96,14 +96,19 @@ class UsersRichText extends StatelessWidget { children: [ RoundedImage(url: user.avatarUrl, size: 20), Text( - ' ${user.nameOrNpub}${users.indexOf(user) == users.length - 1 ? '' : ', '}', + ' ${user.nameOrNpub}', style: TextStyle(fontWeight: FontWeight.bold), ), + Text(users.indexOf(user) == users.length - 1 + ? '' + : (users.indexOf(user) == users.length - 2 + ? ' and ' + : ', ')), ], ), ), if (users.indexOf(user) == users.length - 1) - TextSpan(text: trailingText) + TextSpan(text: trailingText, style: TextStyle(fontSize: 15)) ], ), ],