From 2aaf68c6cc44145b850b136b007f1c87f3d3218f Mon Sep 17 00:00:00 2001 From: franzap <_@franzap.com> Date: Mon, 11 Nov 2024 23:50:19 -0300 Subject: [PATCH] Fix recommended by widget and closed source notice --- lib/screens/app_detail_screen.dart | 72 +++++++++++++----------------- lib/widgets/wot_container.dart | 7 +-- 2 files changed, 36 insertions(+), 43 deletions(-) diff --git a/lib/screens/app_detail_screen.dart b/lib/screens/app_detail_screen.dart index f78869f..cb6ab33 100644 --- a/lib/screens/app_detail_screen.dart +++ b/lib/screens/app_detail_screen.dart @@ -17,6 +17,7 @@ import 'package:zapstore/widgets/release_card.dart'; import 'package:zapstore/widgets/signer_and_developer_row.dart'; import 'package:zapstore/widgets/spinning_logo.dart'; import 'package:zapstore/widgets/versioned_app_header.dart'; +import 'package:zapstore/widgets/wot_container.dart'; class AppDetailScreen extends HookConsumerWidget { final App model; @@ -95,11 +96,10 @@ class AppDetailScreen extends HookConsumerWidget { ), Divider(height: 24), if (curatedBy.isNotEmpty) - for (final user in curatedBy) - AuthorContainer( - user: user, - text: 'Recommended by', - ), + UsersRichText( + trailingText: ' recommended this app', + users: curatedBy.toList(), + ), if (curatedBy.isNotEmpty) Gap(20), MarkdownBody( styleSheet: MarkdownStyleSheet( @@ -119,18 +119,6 @@ class AppDetailScreen extends HookConsumerWidget { child: SignerAndDeveloperRow(app: app), ), Gap(20), - if (app.repository == null) - Container( - padding: EdgeInsets.all(10), - decoration: BoxDecoration( - color: Colors.red[800], - borderRadius: BorderRadius.circular(10), - ), - child: Text( - '⚠️ Source code for this app is not available', - style: TextStyle(fontWeight: FontWeight.bold)), - ), - Gap(10), Container( padding: EdgeInsets.all(10), decoration: BoxDecoration( @@ -139,31 +127,35 @@ class AppDetailScreen extends HookConsumerWidget { ), child: Column( children: [ - if (app.repository != null) - Padding( - padding: const EdgeInsets.all(8), - child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Text('Source'), - Gap(10), - Flexible( - child: GestureDetector( - onTap: () { - launchUrl(Uri.parse(app.repository!)); - }, - child: AutoSizeText( - app.repository!, - minFontSize: 12, - maxLines: 1, - overflow: TextOverflow.ellipsis, - ), - ), + Padding( + padding: const EdgeInsets.all(8), + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Text('Source'), + Gap(10), + Flexible( + child: GestureDetector( + onTap: () { + launchUrl(Uri.parse(app.repository!)); + }, + child: app.repository != null + ? AutoSizeText( + app.repository!, + minFontSize: 12, + maxLines: 1, + overflow: TextOverflow.ellipsis, + ) + : Text('Source code not available', + style: TextStyle( + color: Colors.red[300], + fontWeight: FontWeight.bold)), ), - ], - ), + ), + ], ), + ), Padding( padding: const EdgeInsets.all(8), child: Row( diff --git a/lib/widgets/wot_container.dart b/lib/widgets/wot_container.dart index 3694795..339c741 100644 --- a/lib/widgets/wot_container.dart +++ b/lib/widgets/wot_container.dart @@ -39,6 +39,7 @@ class WebOfTrustContainer extends HookConsumerWidget { preSpan: hasUser && fromNpub != kFranzapNpub ? TextSpan(text: 'You, ') : null, + trailingText: ' and others follow this signer on nostr.', users: trustedUsersWithoutLoggedInUser, ); }, @@ -70,10 +71,12 @@ class UsersRichText extends StatelessWidget { const UsersRichText({ super.key, this.preSpan, + this.trailingText, required this.users, }); final TextSpan? preSpan; + final String? trailingText; final List users; @override @@ -100,9 +103,7 @@ class UsersRichText extends StatelessWidget { ), ), if (users.indexOf(user) == users.length - 1) - TextSpan( - text: ' and others follow this signer on nostr.', - ) + TextSpan(text: trailingText) ], ), ],