Files
afterwork/lib/presentation/widgets/event_interaction_row.dart
2024-09-25 21:28:04 +00:00

44 lines
1.3 KiB
Dart

import 'package:flutter/material.dart';
class EventInteractionRow extends StatelessWidget {
final VoidCallback onReact;
final VoidCallback onComment;
final VoidCallback onShare;
final int reactionsCount;
final int commentsCount;
final int sharesCount;
const EventInteractionRow({
Key? key,
required this.onReact,
required this.onComment,
required this.onShare,
required this.reactionsCount,
required this.commentsCount,
required this.sharesCount,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
_buildIconButton(Icons.thumb_up_alt_outlined, 'Réagir', reactionsCount, onReact),
_buildIconButton(Icons.comment_outlined, 'Commenter', commentsCount, onComment),
_buildIconButton(Icons.share_outlined, 'Partager', sharesCount, onShare),
],
);
}
Widget _buildIconButton(IconData icon, String label, int count, VoidCallback onPressed) {
return TextButton.icon(
onPressed: onPressed,
icon: Icon(icon, color: const Color(0xFF1DBF73), size: 18),
label: Text(
'$label ($count)',
style: const TextStyle(color: Colors.white70, fontSize: 12),
),
);
}
}