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,78 +76,96 @@ class sojornPostCard extends StatelessWidget {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Material(
|
return Material(
|
||||||
color: Colors.transparent,
|
color: Colors.transparent,
|
||||||
child: InkWell(
|
child: Container(
|
||||||
onTap: onTap,
|
margin: const EdgeInsets.only(bottom: 16), // Add spacing between cards
|
||||||
splashColor: AppTheme.queenPink.withOpacity(0.3),
|
padding: _padding,
|
||||||
highlightColor: Colors.transparent,
|
decoration: BoxDecoration(
|
||||||
child: Container(
|
color: AppTheme.cardSurface,
|
||||||
margin: const EdgeInsets.only(bottom: 16), // Add spacing between cards
|
borderRadius: BorderRadius.circular(20),
|
||||||
padding: _padding,
|
border: Border.all(
|
||||||
decoration: BoxDecoration(
|
color: AppTheme.navyBlue.withValues(alpha: 0.3), // Lighter border
|
||||||
color: AppTheme.cardSurface,
|
width: 1.5, // Slightly thinner border
|
||||||
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: Column(
|
boxShadow: [
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
BoxShadow(
|
||||||
children: [
|
color: AppTheme.brightNavy.withValues(alpha: 0.12), // Lighter shadow
|
||||||
const SizedBox(height: 4),
|
blurRadius: 20,
|
||||||
// Header row with menu
|
offset: const Offset(0, 6),
|
||||||
Row(
|
),
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
],
|
||||||
children: [
|
),
|
||||||
Expanded(
|
child: Column(
|
||||||
child: PostHeader(
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
post: post,
|
children: [
|
||||||
avatarSize: _avatarSize,
|
const SizedBox(height: 4),
|
||||||
mode: mode,
|
// 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,
|
PostMenu(
|
||||||
onPostDeleted: onPostChanged,
|
post: post,
|
||||||
),
|
onPostDeleted: onPostChanged,
|
||||||
],
|
),
|
||||||
),
|
],
|
||||||
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),
|
|
||||||
|
|
||||||
// Actions
|
|
||||||
PostActions(
|
|
||||||
post: post,
|
|
||||||
onChain: onChain,
|
|
||||||
onPostChanged: onPostChanged,
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
|
||||||
|
const SizedBox(height: 20),
|
||||||
|
|
||||||
|
// Actions
|
||||||
|
PostActions(
|
||||||
|
post: post,
|
||||||
|
onChain: onChain,
|
||||||
|
onPostChanged: onPostChanged,
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue