90 lines
2.5 KiB
Dart
90 lines
2.5 KiB
Dart
import 'package:flutter/material.dart';
|
|
import '../tokens/unionflow_colors.dart';
|
|
|
|
/// Widget de statistique compacte — style identique à _buildKpiCell du super admin
|
|
/// fond blanc, bordure gauche colorée, icône + valeur + label
|
|
/// [compact] réduit le padding vertical pour les grilles très plates
|
|
class UnionStatWidget extends StatelessWidget {
|
|
final String label;
|
|
final String value;
|
|
final IconData icon;
|
|
final Color color;
|
|
final String? trend;
|
|
final bool? isTrendUp;
|
|
|
|
/// Mode ultra-compact : padding vertical réduit, espacement minimal
|
|
final bool compact;
|
|
|
|
const UnionStatWidget({
|
|
super.key,
|
|
required this.label,
|
|
required this.value,
|
|
required this.icon,
|
|
required this.color,
|
|
this.trend,
|
|
this.isTrendUp,
|
|
this.compact = false,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final EdgeInsets pad = compact
|
|
? const EdgeInsets.symmetric(horizontal: 8, vertical: 5)
|
|
: const EdgeInsets.all(6);
|
|
|
|
return Container(
|
|
padding: pad,
|
|
decoration: BoxDecoration(
|
|
color: UnionFlowColors.surface,
|
|
borderRadius: BorderRadius.circular(10),
|
|
border: Border(left: BorderSide(color: color, width: 3)),
|
|
),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Row(
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: [
|
|
Icon(icon, size: 13, color: color),
|
|
if (trend != null) ...[
|
|
const Spacer(),
|
|
Text(
|
|
trend!,
|
|
style: TextStyle(
|
|
fontSize: 8,
|
|
fontWeight: FontWeight.w700,
|
|
color: color,
|
|
),
|
|
),
|
|
],
|
|
],
|
|
),
|
|
SizedBox(height: compact ? 2 : 4),
|
|
Text(
|
|
value,
|
|
style: TextStyle(
|
|
fontSize: 17,
|
|
fontWeight: FontWeight.w800,
|
|
color: color,
|
|
letterSpacing: -0.3,
|
|
height: 1,
|
|
),
|
|
),
|
|
SizedBox(height: compact ? 1 : 2),
|
|
Text(
|
|
label,
|
|
style: const TextStyle(
|
|
fontSize: 9,
|
|
fontWeight: FontWeight.w500,
|
|
color: UnionFlowColors.textSecondary,
|
|
),
|
|
maxLines: 1,
|
|
overflow: TextOverflow.ellipsis,
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|