import 'package:flutter/material.dart'; import 'package:shimmer/shimmer.dart'; import 'core_card.dart'; /// UnionFlow Mobile - Composant DRY : CoreShimmer /// Utilise `shimmer` package pour générer des loaders élégants sans textes. class CoreShimmer extends StatelessWidget { final int itemCount; const CoreShimmer({ Key? key, this.itemCount = 5, }) : super(key: key); @override Widget build(BuildContext context) { final isDark = Theme.of(context).brightness == Brightness.dark; final baseColor = isDark ? Colors.grey[800]! : Colors.grey[300]!; final highlightColor = isDark ? Colors.grey[700]! : Colors.grey[100]!; return ListView.builder( itemCount: itemCount, shrinkWrap: true, physics: const NeverScrollableScrollPhysics(), itemBuilder: (_, __) => Padding( padding: const EdgeInsets.only(bottom: 8.0), child: Shimmer.fromColors( baseColor: baseColor, highlightColor: highlightColor, child: CoreCard( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( children: [ CircleAvatar(radius: 16, backgroundColor: Colors.white), SizedBox(width: 8), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Container(width: 100, height: 10, color: Colors.white), SizedBox(height: 4), Container(width: 40, height: 8, color: Colors.white), ], ), ), ], ), SizedBox(height: 12), Container(width: double.infinity, height: 10, color: Colors.white), SizedBox(height: 4), Container(width: 250, height: 10, color: Colors.white), SizedBox(height: 4), Container(width: 150, height: 10, color: Colors.white), SizedBox(height: 12), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Container(width: 40, height: 12, color: Colors.white), Container(width: 40, height: 12, color: Colors.white), Container(width: 40, height: 12, color: Colors.white), ], ), ], ), ), ), ), ); } }