Refactoring + Version améliorée

This commit is contained in:
DahoudG
2024-09-25 21:28:04 +00:00
parent 6b12cfeb41
commit 8e625c1080
28 changed files with 1113 additions and 261 deletions

View File

@@ -0,0 +1,43 @@
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),
),
);
}
}