feat : EvenDetails --> Add Animator with widget
This commit is contained in:
56
lib/ui/common/animator_widget.dart
Normal file
56
lib/ui/common/animator_widget.dart
Normal file
@@ -0,0 +1,56 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class AnimatorWidget extends StatefulWidget {
|
||||
final String authorName;
|
||||
final String authorImageUrl;
|
||||
final DateTime? publishDate;
|
||||
final List<String>? imageUrls;
|
||||
final int likesCount;
|
||||
final int commentsCount;
|
||||
final int sharesCount;
|
||||
final VoidCallback? onLike;
|
||||
final VoidCallback? onComment;
|
||||
final VoidCallback? onShare;
|
||||
final double? aspectRatio; // Nouveau paramètre pour le ratio (largeur/hauteur)
|
||||
|
||||
const AnimatorWidget({
|
||||
Key? key,
|
||||
required this.authorName,
|
||||
required this.authorImageUrl,
|
||||
this.publishDate,
|
||||
this.imageUrls,
|
||||
this.likesCount = 0,
|
||||
this.commentsCount = 0,
|
||||
this.sharesCount = 0,
|
||||
this.onLike,
|
||||
this.onComment,
|
||||
this.onShare,
|
||||
this.aspectRatio, // null = ratio naturel de l'image, ex: 16/9, 4/3, 1/1
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<AnimatorWidget> createState() => _AnimatorWidgetWidgetState();
|
||||
}
|
||||
|
||||
class _AnimatorWidgetWidgetState extends State<AnimatorWidget> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
children: [
|
||||
CircleAvatar(
|
||||
backgroundImage: NetworkImage(widget.authorImageUrl),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(widget.authorName, style: Theme.of(context).textTheme.bodyLarge?.copyWith(color: Colors.black)),
|
||||
//Text('${widget.publishDate.toLocal()}'.split(' ')[0], style: const TextStyle(color: Colors.grey, fontSize: 12)),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user