···
+
import 'package:flutter/foundation.dart';
+
import 'package:flutter/material.dart';
+
import 'package:flutter/services.dart';
+
import 'package:provider/provider.dart';
+
import '../constants/app_colors.dart';
+
import '../models/post.dart';
+
import '../providers/auth_provider.dart';
+
import '../providers/vote_provider.dart';
+
import '../utils/date_time_utils.dart';
+
import 'icons/animated_heart_icon.dart';
+
import 'icons/reply_icon.dart';
+
import 'icons/share_icon.dart';
+
import 'sign_in_dialog.dart';
+
/// Action buttons row for post cards
+
/// Displays menu, share, comment, and like buttons with proper
+
/// authentication handling and optimistic updates.
+
class PostCardActions extends StatelessWidget {
+
const PostCardActions({required this.post, super.key});
+
final FeedViewPost post;
+
Widget build(BuildContext context) {
+
mainAxisAlignment: MainAxisAlignment.spaceBetween,
+
// Left side: Three dots menu and share
+
mainAxisSize: MainAxisSize.min,
+
// Three dots menu button
+
label: 'Post options menu',
+
// TODO: Show post options menu
+
debugPrint('Menu button tapped for post');
+
padding: const EdgeInsets.symmetric(
+
color: AppColors.textPrimary.withValues(alpha: 0.6),
+
// TODO: Handle share interaction with backend
+
debugPrint('Share button tapped for post');
+
padding: const EdgeInsets.symmetric(
+
color: AppColors.textPrimary.withValues(alpha: 0.6),
+
// Right side: Comment and heart
+
mainAxisSize: MainAxisSize.min,
+
'View ${post.post.stats.commentCount} ${post.post.stats.commentCount == 1 ? "comment" : "comments"}',
+
// TODO: Navigate to post detail/comments screen
+
debugPrint('Comment button tapped for post');
+
padding: const EdgeInsets.symmetric(
+
mainAxisSize: MainAxisSize.min,
+
color: AppColors.textPrimary.withValues(alpha: 0.6),
+
const SizedBox(width: 5),
+
DateTimeUtils.formatCount(post.post.stats.commentCount),
+
color: AppColors.textPrimary.withValues(alpha: 0.6),
+
const SizedBox(width: 8),
+
Consumer<VoteProvider>(
+
builder: (context, voteProvider, child) {
+
final isLiked = voteProvider.isLiked(post.post.uri);
+
final adjustedScore = voteProvider.getAdjustedScore(
+
? 'Unlike post, $adjustedScore ${adjustedScore == 1 ? "like" : "likes"}'
+
: 'Like post, $adjustedScore ${adjustedScore == 1 ? "like" : "likes"}',
+
// Check authentication
+
final authProvider = context.read<AuthProvider>();
+
if (!authProvider.isAuthenticated) {
+
final shouldSignIn = await SignInDialog.show(
+
message: 'You need to sign in to like posts.',
+
if ((shouldSignIn ?? false) && context.mounted) {
+
// TODO: Navigate to sign-in screen
+
debugPrint('Navigate to sign-in screen');
+
// Light haptic feedback on both like and unlike
+
await HapticFeedback.lightImpact();
+
// Toggle vote with optimistic update
+
await voteProvider.toggleVote(
+
postUri: post.post.uri,
+
postCid: post.post.cid,
+
} on Exception catch (e) {
+
debugPrint('Failed to toggle vote: $e');
+
// TODO: Show error snackbar
+
padding: const EdgeInsets.symmetric(
+
mainAxisSize: MainAxisSize.min,
+
color: AppColors.textPrimary.withValues(alpha: 0.6),
+
likedColor: const Color(0xFFFF0033),
+
const SizedBox(width: 5),
+
DateTimeUtils.formatCount(adjustedScore),
+
color: AppColors.textPrimary.withValues(