refactoring

This commit is contained in:
DahoudG
2024-11-02 15:27:26 +00:00
parent 8e625c1080
commit 9cf96b7acf
44 changed files with 2281 additions and 354 deletions

View File

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