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