49 lines
1.4 KiB
Dart
49 lines
1.4 KiB
Dart
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, 'J’aime', 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,
|
||
),
|
||
);
|
||
}
|
||
}
|