Pattern AppColors pair (isDark ? AppColors.surfaceDark : AppColors.surface) appliqué sur : - UnionStatWidget, UnionBalanceCard, UnionActionButton, UFSectionHeader - DashboardEventRow, DashboardActivityRow, UnionExportButton - MiniAvatar (border adaptatif) - ConfirmationDialog (cancel colors adaptés) - FileUploadWidget (textSecondary adaptatif) Les couleurs surface/border/textPrimary/textSecondary hardcodées (light-only) sont remplacées par les paires *Dark conditionnelles. Les couleurs sémantiques (error, success, warning, primary) restent inchangées.
119 lines
4.3 KiB
Dart
119 lines
4.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
import '../tokens/app_colors.dart';
|
|
import '../tokens/unionflow_colors.dart';
|
|
|
|
/// Card de balance UnionFlow — Affichage élégant du solde principal
|
|
/// Adaptatif dark/light via AppColors
|
|
class UnionBalanceCard extends StatelessWidget {
|
|
final String label;
|
|
final String amount;
|
|
final String? trend;
|
|
final bool? isTrendPositive;
|
|
final VoidCallback? onTap;
|
|
|
|
const UnionBalanceCard({
|
|
super.key,
|
|
required this.label,
|
|
required this.amount,
|
|
this.trend,
|
|
this.isTrendPositive,
|
|
this.onTap,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final isDark = Theme.of(context).brightness == Brightness.dark;
|
|
final bgColor = isDark ? AppColors.surfaceDark : AppColors.surface;
|
|
final borderColor = isDark ? AppColors.borderDark : AppColors.border;
|
|
final textPrimary = isDark ? AppColors.textPrimaryDark : AppColors.textPrimary;
|
|
final textSecondary= isDark ? AppColors.textSecondaryDark: AppColors.textSecondary;
|
|
|
|
return GestureDetector(
|
|
onTap: onTap,
|
|
child: ClipRRect(
|
|
borderRadius: BorderRadius.circular(10),
|
|
child: Container(
|
|
decoration: BoxDecoration(
|
|
color: bgColor,
|
|
border: Border.all(color: borderColor),
|
|
),
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Container(height: 2, color: UnionFlowColors.gold),
|
|
Padding(
|
|
padding: const EdgeInsets.fromLTRB(14, 10, 14, 12),
|
|
child: Row(
|
|
children: [
|
|
Expanded(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
label.toUpperCase(),
|
|
style: TextStyle(
|
|
fontSize: 9,
|
|
fontWeight: FontWeight.w600,
|
|
color: textSecondary,
|
|
letterSpacing: 0.8,
|
|
),
|
|
),
|
|
const SizedBox(height: 4),
|
|
Text(
|
|
amount,
|
|
style: TextStyle(
|
|
fontSize: 22,
|
|
fontWeight: FontWeight.w800,
|
|
color: textPrimary,
|
|
height: 1,
|
|
letterSpacing: -0.5,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
if (trend != null)
|
|
Column(
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
children: [
|
|
Row(
|
|
children: [
|
|
Icon(
|
|
isTrendPositive == true
|
|
? Icons.arrow_upward_rounded
|
|
: Icons.arrow_downward_rounded,
|
|
size: 11,
|
|
color: isTrendPositive == true
|
|
? AppColors.success
|
|
: AppColors.error,
|
|
),
|
|
const SizedBox(width: 2),
|
|
Text(
|
|
trend!,
|
|
style: TextStyle(
|
|
fontSize: 12,
|
|
fontWeight: FontWeight.w700,
|
|
color: isTrendPositive == true
|
|
? AppColors.success
|
|
: AppColors.error,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
Text(
|
|
'ce mois',
|
|
style: TextStyle(fontSize: 9, color: textSecondary),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|