Refactoring + Version améliorée
This commit is contained in:
43
lib/presentation/widgets/event_interaction_row.dart
Normal file
43
lib/presentation/widgets/event_interaction_row.dart
Normal 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),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user