Files
afterwork/lib/presentation/widgets/social_interaction_row.dart
2024-11-02 15:27:26 +00:00

49 lines
1.4 KiB
Dart
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import 'package:flutter/material.dart';
import '../../../core/constants/colors.dart';
import '../../../data/models/social_post_model.dart';
class SocialInteractionRow extends StatelessWidget {
final SocialPost post;
final VoidCallback onLike;
final VoidCallback onComment;
final VoidCallback onShare;
const SocialInteractionRow({
Key? key,
required this.post,
required this.onLike,
required this.onComment,
required this.onShare,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Expanded(
child: _buildIconButton(Icons.thumb_up_alt_outlined, 'Jaime', post.likes, onLike),
),
Expanded(
child: _buildIconButton(Icons.comment_outlined, 'Commentaires', post.comments, onComment),
),
Expanded(
child: _buildIconButton(Icons.share_outlined, 'Partages', post.shares, onShare),
),
],
);
}
Widget _buildIconButton(IconData icon, String label, int count, VoidCallback onPressed) {
return TextButton.icon(
onPressed: onPressed,
icon: Icon(icon, color: AppColors.accentColor, size: 18),
label: Text(
'$label ($count)',
style: const TextStyle(color: Colors.white70, fontSize: 12),
overflow: TextOverflow.ellipsis,
),
);
}
}