99 lines
3.1 KiB
Dart
99 lines
3.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
import '../../../core/theme/app_theme.dart';
|
|
import '../../../core/widgets/glass_container.dart';
|
|
|
|
/// Widget carte télémétrique moderne avec effet Glassmorphism givré.
|
|
class StatsCard extends StatelessWidget {
|
|
final IconData icon;
|
|
final String title;
|
|
final String value;
|
|
final Color color;
|
|
final String? subtitle;
|
|
|
|
const StatsCard({
|
|
super.key,
|
|
required this.icon,
|
|
required this.title,
|
|
required this.value,
|
|
required this.color,
|
|
this.subtitle,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final isDark = Theme.of(context).brightness == Brightness.dark;
|
|
final textSecondary = isDark ? AppTheme.darkTextSecondary : AppTheme.lightTextSecondary;
|
|
|
|
return GlassContainer(
|
|
borderRadius: 18,
|
|
blur: 14,
|
|
glowColor: color,
|
|
borderColor: isDark ? color.withValues(alpha: 0.22) : color.withValues(alpha: 0.18),
|
|
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 14),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Container(
|
|
padding: const EdgeInsets.all(8),
|
|
decoration: BoxDecoration(
|
|
color: color.withValues(alpha: isDark ? 0.18 : 0.12),
|
|
borderRadius: BorderRadius.circular(10),
|
|
border: Border.all(
|
|
color: color.withValues(alpha: isDark ? 0.35 : 0.25),
|
|
width: 1,
|
|
),
|
|
),
|
|
child: Icon(icon, color: color, size: 20),
|
|
),
|
|
if (subtitle != null)
|
|
Container(
|
|
padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 2),
|
|
decoration: BoxDecoration(
|
|
color: (isDark ? Colors.white : Colors.black).withValues(alpha: 0.05),
|
|
borderRadius: BorderRadius.circular(6),
|
|
),
|
|
child: Text(
|
|
subtitle!,
|
|
style: TextStyle(
|
|
fontSize: 10,
|
|
fontWeight: FontWeight.w600,
|
|
color: textSecondary,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
const SizedBox(height: 12),
|
|
Text(
|
|
value,
|
|
style: TextStyle(
|
|
fontSize: 22,
|
|
fontWeight: FontWeight.w800,
|
|
color: isDark ? AppTheme.darkTextPrimary : AppTheme.lightTextPrimary,
|
|
letterSpacing: -0.5,
|
|
),
|
|
maxLines: 1,
|
|
overflow: TextOverflow.ellipsis,
|
|
),
|
|
const SizedBox(height: 2),
|
|
Text(
|
|
title,
|
|
style: TextStyle(
|
|
fontSize: 12,
|
|
fontWeight: FontWeight.w500,
|
|
color: textSecondary,
|
|
letterSpacing: 0.1,
|
|
),
|
|
maxLines: 1,
|
|
overflow: TextOverflow.ellipsis,
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|