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,78 +76,96 @@ 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,
decoration: BoxDecoration(
color: AppTheme.cardSurface,
borderRadius: BorderRadius.circular(20),
border: Border.all(
color: AppTheme.navyBlue.withValues(alpha: 0.3), // Lighter border
width: 1.5, // Slightly thinner border
),
boxShadow: [
BoxShadow(
color: AppTheme.brightNavy.withValues(alpha: 0.12), // Lighter shadow
blurRadius: 20,
offset: const Offset(0, 6),
),
],
child: Container(
margin: const EdgeInsets.only(bottom: 16), // Add spacing between cards
padding: _padding,
decoration: BoxDecoration(
color: AppTheme.cardSurface,
borderRadius: BorderRadius.circular(20),
border: Border.all(
color: AppTheme.navyBlue.withValues(alpha: 0.3), // Lighter border
width: 1.5, // Slightly thinner border
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(height: 4),
// Header row with menu
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: PostHeader(
post: post,
avatarSize: _avatarSize,
mode: mode,
boxShadow: [
BoxShadow(
color: AppTheme.brightNavy.withValues(alpha: 0.12), // Lighter shadow
blurRadius: 20,
offset: const Offset(0, 6),
),
],
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(height: 4),
// 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,
),
],
),
const SizedBox(height: 16),
),
PostMenu(
post: post,
onPostDeleted: onPostChanged,
),
],
),
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)
if (post.imageUrl != null && post.imageUrl!.isNotEmpty) ...[
const SizedBox(height: 16),
PostMedia(
// Media (if available) - clickable for post detail
if (post.imageUrl != null && post.imageUrl!.isNotEmpty) ...[
const SizedBox(height: 16),
InkWell(
onTap: onTap,
borderRadius: BorderRadius.circular(AppTheme.radiusMd),
child: PostMedia(
post: post,
mode: mode,
),
],
const SizedBox(height: 20),
// Actions
PostActions(
post: post,
onChain: onChain,
onPostChanged: onPostChanged,
),
],
),
const SizedBox(height: 20),
// Actions
PostActions(
post: post,
onChain: onChain,
onPostChanged: onPostChanged,
),
],
),
),
);