import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; class StatCard extends StatelessWidget { final String title; final String value; final IconData icon; final Color color; final String? trend; final bool isTrendPositive; const StatCard({ super.key, required this.title, required this.value, required this.icon, required this.color, this.trend, this.isTrendPositive = true, }); @override Widget build(BuildContext context) { return Container( padding: const EdgeInsets.all(16), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(16), boxShadow: [ BoxShadow( color: Colors.black.withOpacity(0.03), blurRadius: 10, offset: const Offset(0, 4), ), ], ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Container( padding: const EdgeInsets.all(8), decoration: BoxDecoration( color: color.withOpacity(0.1), borderRadius: BorderRadius.circular(8), ), child: Icon(icon, color: color, size: 20), ), if (trend != null) Container( padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4), decoration: BoxDecoration( color: isTrendPositive ? Colors.green.withOpacity(0.1) : Colors.red.withOpacity(0.1), borderRadius: BorderRadius.circular(12), ), child: Row( mainAxisSize: MainAxisSize.min, children: [ Icon( isTrendPositive ? Icons.arrow_upward : Icons.arrow_downward, size: 12, color: isTrendPositive ? Colors.green : Colors.red, ), const SizedBox(width: 4), Text( trend!, style: GoogleFonts.nunito( fontSize: 10, fontWeight: FontWeight.bold, color: isTrendPositive ? Colors.green : Colors.red, ), ), ], ), ), ], ), const SizedBox(height: 16), Text( value, style: GoogleFonts.nunito( fontSize: 24, fontWeight: FontWeight.bold, color: Colors.black87, ), ), const SizedBox(height: 4), Text( title, style: GoogleFonts.nunito( fontSize: 14, color: Colors.grey[500], ), ), ], ), ); } }