From 90a84a78705f191e7e477634dcf062005d16e014 Mon Sep 17 00:00:00 2001 From: Bretton Date: Wed, 05 Aug 2026 08:18:45 +0000 Subject: [PATCH] feat(post-detail): make the community title navigate to its feed The community header in the post detail app bar (avatar, !name and instance) was inert, so the only way to reach a community from a post was to go back to the feed and find one of its cards. Wraps it in the existing TappableCommunity widget — the same one the feed cards use — so the gesture and its /community/ route match the rest of the app. Changes: - Wrap the community title Row in TappableCommunity - Floor the tap target at 48pt via ConstrainedBox; the 28pt avatar left it short of the accessibility minimum, and 48 still clears kToolbarHeight (56) so the app bar is unaffected Co-Authored-By: Claude Opus 5 (1M context) --- lib/screens/home/post_detail_screen.dart | 82 ++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------- 1 file(s) changed, 48 insertion(s)(+), 34 deletion(s)(-) diff --git a/lib/screens/home/post_detail_screen.dart b/lib/screens/home/post_detail_screen.dart --- a/lib/screens/home/post_detail_screen.dart +++ b/lib/screens/home/post_detail_screen.dart @@ -23,6 +23,7 @@ import '../../widgets/post_action_bar.dart'; import '../../widgets/report_dialog.dart'; import '../../widgets/sign_in_dialog.dart'; import '../../widgets/status_bar_overlay.dart'; +import '../../widgets/tappable_community.dart'; import '../compose/reply_screen.dart'; import 'focused_thread_screen.dart'; @@ -336,7 +337,9 @@ ), ); } - /// Build community title with avatar, name on top and instance below + /// Build community title with avatar, name on top and instance below. + /// + /// Tapping the title navigates to the community's feed. Widget _buildCommunityTitle() { final community = widget.post.post.community; @@ -351,41 +354,52 @@ instance = parts.sublist(parts.length - 2).join('.'); } } - return Row( - mainAxisSize: MainAxisSize.min, - children: [ - // Community avatar - _buildCommunityAvatar(community), - const SizedBox(width: 10), - // Text column - Flexible( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - // Community name with ! prefix - bigger, teal - Text( - '!${community.name}', - style: const TextStyle( - fontSize: 17, - fontWeight: FontWeight.w700, - color: AppColors.communityName, - ), - overflow: TextOverflow.ellipsis, - ), - // Instance below - smaller - Text( - instance, - style: TextStyle( - fontSize: 12, - fontWeight: FontWeight.w400, - color: AppColors.textSecondary.withValues(alpha: 0.8), - ), + return TappableCommunity( + communityDid: community.did, + borderRadius: 8, + padding: const EdgeInsets.symmetric(horizontal: 4), + // The avatar is only 28pt tall, so without a floor the tap target + // lands short of the 48pt minimum. 48 still clears kToolbarHeight + // (56), so the app bar is unaffected. + child: ConstrainedBox( + constraints: const BoxConstraints(minHeight: 48), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + // Community avatar + _buildCommunityAvatar(community), + const SizedBox(width: 10), + // Text column + Flexible( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + // Community name with ! prefix - bigger, teal + Text( + '!${community.name}', + style: const TextStyle( + fontSize: 17, + fontWeight: FontWeight.w700, + color: AppColors.communityName, + ), + overflow: TextOverflow.ellipsis, + ), + // Instance below - smaller + Text( + instance, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w400, + color: AppColors.textSecondary.withValues(alpha: 0.8), + ), + ), + ], ), - ], - ), + ), + ], ), - ], + ), ); } -- tangled.sh