76 lines
1.8 KiB
Dart
76 lines
1.8 KiB
Dart
/// UnionFlow Metric Card - Card de métrique système
|
|
///
|
|
/// Card compacte pour afficher une métrique système (CPU, RAM, etc.)
|
|
library uf_metric_card;
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import '../../unionflow_design_system.dart';
|
|
|
|
/// Card de métrique système
|
|
///
|
|
/// Usage:
|
|
/// ```dart
|
|
/// UFMetricCard(
|
|
/// label: 'CPU',
|
|
/// value: '23.5%',
|
|
/// icon: Icons.memory,
|
|
/// color: ColorTokens.success,
|
|
/// )
|
|
/// ```
|
|
class UFMetricCard extends StatelessWidget {
|
|
/// Label de la métrique (ex: "CPU")
|
|
final String label;
|
|
|
|
/// Valeur de la métrique (ex: "23.5%")
|
|
final String value;
|
|
|
|
/// Icône représentant la métrique
|
|
final IconData icon;
|
|
|
|
/// Couleur de la métrique (optionnel)
|
|
final Color? color;
|
|
|
|
const UFMetricCard({
|
|
super.key,
|
|
required this.label,
|
|
required this.value,
|
|
required this.icon,
|
|
this.color,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
padding: const EdgeInsets.all(SpacingTokens.md),
|
|
decoration: BoxDecoration(
|
|
color: Colors.white.withOpacity(0.15),
|
|
borderRadius: BorderRadius.circular(SpacingTokens.radiusMd),
|
|
),
|
|
child: Column(
|
|
children: [
|
|
Icon(icon, color: Colors.white, size: 16),
|
|
const SizedBox(height: SpacingTokens.sm),
|
|
Text(
|
|
value,
|
|
style: AppTypography.badgeText.copyWith(
|
|
fontWeight: FontWeight.bold,
|
|
color: Colors.white,
|
|
),
|
|
textAlign: TextAlign.center,
|
|
),
|
|
Text(
|
|
label,
|
|
style: AppTypography.badgeText.copyWith(
|
|
fontSize: 9,
|
|
color: Colors.white.withOpacity(0.8),
|
|
),
|
|
textAlign: TextAlign.center,
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|