import 'package:flutter/material.dart'; import '../../app/theme.dart'; /// Card metrica singola (segnale, Mbps, fps). class MetricCard extends StatelessWidget { const MetricCard({ super.key, required this.label, required this.value, this.icon, this.highlight = false, this.expand = true, }); final String label; final String value; final IconData? icon; final bool highlight; final bool expand; @override Widget build(BuildContext context) { final theme = Theme.of(context); final card = Container( padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 8), decoration: BoxDecoration( color: AppTheme.surfaceElevated, borderRadius: BorderRadius.circular(10), border: highlight ? Border.all(color: AppTheme.successGreen.withValues(alpha: 0.5)) : null, ), child: Column( mainAxisSize: MainAxisSize.min, children: [ if (icon != null) ...[ Icon(icon, size: 18, color: AppTheme.textSecondary), const SizedBox(height: 4), ], Text( value, style: theme.textTheme.titleLarge?.copyWith( color: highlight ? AppTheme.successGreen : Colors.white, fontWeight: FontWeight.w900, ), textAlign: TextAlign.center, ), const SizedBox(height: 2), Text( label, style: theme.textTheme.bodyMedium?.copyWith(fontSize: 11), textAlign: TextAlign.center, ), ], ), ); if (!expand) { return SizedBox(width: 72, child: card); } return Expanded(child: card); } }