106 lines
2.7 KiB
Dart
106 lines
2.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
import '../tokens/unionflow_colors.dart';
|
|
|
|
/// Widget de statistique compacte avec icône et tendance
|
|
class UnionStatWidget extends StatelessWidget {
|
|
final String label;
|
|
final String value;
|
|
final IconData icon;
|
|
final Color color;
|
|
final String? trend;
|
|
final bool? isTrendUp;
|
|
|
|
const UnionStatWidget({
|
|
super.key,
|
|
required this.label,
|
|
required this.value,
|
|
required this.icon,
|
|
required this.color,
|
|
this.trend,
|
|
this.isTrendUp,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
padding: const EdgeInsets.all(16),
|
|
decoration: BoxDecoration(
|
|
color: UnionFlowColors.surface,
|
|
borderRadius: BorderRadius.circular(16),
|
|
boxShadow: UnionFlowColors.softShadow,
|
|
border: Border(
|
|
left: BorderSide(
|
|
color: color,
|
|
width: 4,
|
|
),
|
|
),
|
|
),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
// Icon
|
|
Container(
|
|
padding: const EdgeInsets.all(8),
|
|
decoration: BoxDecoration(
|
|
color: color.withOpacity(0.1),
|
|
borderRadius: BorderRadius.circular(8),
|
|
),
|
|
child: Icon(icon, size: 20, color: color),
|
|
),
|
|
const SizedBox(height: 12),
|
|
|
|
// Value
|
|
Text(
|
|
value,
|
|
style: TextStyle(
|
|
fontSize: 24,
|
|
fontWeight: FontWeight.w700,
|
|
color: color,
|
|
),
|
|
),
|
|
const SizedBox(height: 4),
|
|
|
|
// Label
|
|
Text(
|
|
label,
|
|
style: const TextStyle(
|
|
fontSize: 11,
|
|
fontWeight: FontWeight.w600,
|
|
color: UnionFlowColors.textSecondary,
|
|
),
|
|
),
|
|
|
|
// Trend
|
|
if (trend != null) ...[
|
|
const SizedBox(height: 8),
|
|
Row(
|
|
children: [
|
|
Icon(
|
|
isTrendUp == true
|
|
? Icons.trending_up
|
|
: Icons.trending_down,
|
|
size: 14,
|
|
color: isTrendUp == true
|
|
? UnionFlowColors.success
|
|
: UnionFlowColors.error,
|
|
),
|
|
const SizedBox(width: 4),
|
|
Text(
|
|
trend!,
|
|
style: TextStyle(
|
|
fontSize: 11,
|
|
fontWeight: FontWeight.w600,
|
|
color: isTrendUp == true
|
|
? UnionFlowColors.success
|
|
: UnionFlowColors.error,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|