Restrict clickable area to user profile section only

- Remove InkWell wrapper from entire card
- Add separate InkWell for PostHeader area only
- Add separate InkWell for PostBody and PostMedia areas
- Only user name/avatar area navigates to profile
- Post content areas navigate to post detail (onTap)
- PostMenu remains separate and unaffected
- Add AppRoutes import for profile navigation
- Maintain proper visual feedback with borderRadius
This commit is contained in:
Patrick Britton 2026-02-01 14:00:54 -06:00
parent d3b102aaf5
commit eb3957febc

View file

@ -7,6 +7,7 @@ import 'post/post_header.dart';
import 'post/post_media.dart';
import 'post/post_menu.dart';
import 'post/post_view_mode.dart';
import '../routes/app_routes.dart';
/// Unified Post Card - Single Source of Truth for post display.
///
@ -75,10 +76,6 @@ class sojornPostCard extends StatelessWidget {
Widget build(BuildContext context) {
return Material(
color: Colors.transparent,
child: InkWell(
onTap: onTap,
splashColor: AppTheme.queenPink.withOpacity(0.3),
highlightColor: Colors.transparent,
child: Container(
margin: const EdgeInsets.only(bottom: 16), // Add spacing between cards
padding: _padding,
@ -101,17 +98,32 @@ class sojornPostCard extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(height: 4),
// Header row with menu
// Header row with menu - only header is clickable for profile
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: InkWell(
onTap: () {
final handle = post.author?.handle ?? 'unknown';
if (handle != 'unknown' && handle.trim().isNotEmpty) {
AppRoutes.navigateToProfile(context, handle);
}
},
borderRadius: BorderRadius.circular(AppTheme.radiusMd),
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 4,
vertical: 4,
),
child: PostHeader(
post: post,
avatarSize: _avatarSize,
mode: mode,
),
),
),
),
PostMenu(
post: post,
onPostDeleted: onPostChanged,
@ -120,21 +132,29 @@ class sojornPostCard extends StatelessWidget {
),
const SizedBox(height: 16),
// Body text
PostBody(
// Body text - clickable for post detail
InkWell(
onTap: onTap,
borderRadius: BorderRadius.circular(AppTheme.radiusMd),
child: PostBody(
text: post.body,
bodyFormat: post.bodyFormat,
backgroundId: post.backgroundId,
mode: mode,
),
),
// Media (if available)
// Media (if available) - clickable for post detail
if (post.imageUrl != null && post.imageUrl!.isNotEmpty) ...[
const SizedBox(height: 16),
PostMedia(
InkWell(
onTap: onTap,
borderRadius: BorderRadius.circular(AppTheme.radiusMd),
child: PostMedia(
post: post,
mode: mode,
),
),
],
const SizedBox(height: 20),
@ -148,7 +168,6 @@ class sojornPostCard extends StatelessWidget {
],
),
),
),
);
}
}