feat(design-system): dark mode adaptatif sur widgets partagés
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.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import '../tokens/app_colors.dart';
|
||||
import '../tokens/unionflow_colors.dart';
|
||||
|
||||
/// Type d'export disponible
|
||||
@@ -12,7 +13,7 @@ enum ExportType {
|
||||
const ExportType(this.label, this.icon);
|
||||
}
|
||||
|
||||
/// Bouton d'export avec options
|
||||
/// Bouton d'export avec options — adaptatif dark/light via AppColors
|
||||
class UnionExportButton extends StatelessWidget {
|
||||
final Function(ExportType) onExport;
|
||||
final bool isLoading;
|
||||
@@ -25,6 +26,10 @@ class UnionExportButton extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final isDark = Theme.of(context).brightness == Brightness.dark;
|
||||
final bgPopup = isDark ? AppColors.surfaceDark : AppColors.surface;
|
||||
final textColor= isDark ? AppColors.textPrimaryDark : AppColors.textPrimary;
|
||||
|
||||
return PopupMenuButton<ExportType>(
|
||||
icon: Container(
|
||||
padding: const EdgeInsets.all(10),
|
||||
@@ -42,29 +47,21 @@ class UnionExportButton extends StatelessWidget {
|
||||
valueColor: AlwaysStoppedAnimation<Color>(Colors.white),
|
||||
),
|
||||
)
|
||||
: const Icon(
|
||||
Icons.download,
|
||||
color: Colors.white,
|
||||
size: 20,
|
||||
),
|
||||
: const Icon(Icons.download, color: Colors.white, size: 20),
|
||||
),
|
||||
itemBuilder: (context) => ExportType.values.map((type) {
|
||||
return PopupMenuItem<ExportType>(
|
||||
value: type,
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(
|
||||
type.icon,
|
||||
size: 20,
|
||||
color: UnionFlowColors.unionGreen,
|
||||
),
|
||||
Icon(type.icon, size: 20, color: UnionFlowColors.unionGreen),
|
||||
const SizedBox(width: 12),
|
||||
Text(
|
||||
'Exporter en ${type.label}',
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: UnionFlowColors.textPrimary,
|
||||
color: textColor,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -72,16 +69,14 @@ class UnionExportButton extends StatelessWidget {
|
||||
);
|
||||
}).toList(),
|
||||
onSelected: onExport,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
||||
elevation: 8,
|
||||
color: UnionFlowColors.surface,
|
||||
color: bgPopup,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// Dialog pour confirmer l'export
|
||||
/// Dialog pour confirmer l'export — adaptatif dark/light via AppColors
|
||||
class ExportConfirmDialog extends StatelessWidget {
|
||||
final ExportType exportType;
|
||||
final VoidCallback onConfirm;
|
||||
@@ -96,11 +91,14 @@ class ExportConfirmDialog extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final isDark = Theme.of(context).brightness == Brightness.dark;
|
||||
final bgColor = isDark ? AppColors.surfaceDark : AppColors.surface;
|
||||
final textPrimary = isDark ? AppColors.textPrimaryDark : AppColors.textPrimary;
|
||||
final textSecondary = isDark ? AppColors.textSecondaryDark: AppColors.textSecondary;
|
||||
|
||||
return AlertDialog(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
backgroundColor: UnionFlowColors.surface,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)),
|
||||
backgroundColor: bgColor,
|
||||
title: Row(
|
||||
children: [
|
||||
Container(
|
||||
@@ -109,39 +107,27 @@ class ExportConfirmDialog extends StatelessWidget {
|
||||
color: UnionFlowColors.unionGreen.withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Icon(
|
||||
exportType.icon,
|
||||
color: UnionFlowColors.unionGreen,
|
||||
size: 24,
|
||||
),
|
||||
child: Icon(exportType.icon, color: UnionFlowColors.unionGreen, size: 24),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Text(
|
||||
'Exporter en ${exportType.label}',
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: UnionFlowColors.textPrimary,
|
||||
Expanded(
|
||||
child: Text(
|
||||
'Exporter en ${exportType.label}',
|
||||
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w700, color: textPrimary),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
content: Text(
|
||||
message ?? 'Voulez-vous exporter le rapport au format ${exportType.label}?',
|
||||
style: const TextStyle(
|
||||
fontSize: 14,
|
||||
color: UnionFlowColors.textSecondary,
|
||||
),
|
||||
style: TextStyle(fontSize: 14, color: textSecondary),
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
child: const Text(
|
||||
child: Text(
|
||||
'Annuler',
|
||||
style: TextStyle(
|
||||
color: UnionFlowColors.textSecondary,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
style: TextStyle(color: textSecondary, fontWeight: FontWeight.w600),
|
||||
),
|
||||
),
|
||||
ElevatedButton(
|
||||
@@ -152,15 +138,10 @@ class ExportConfirmDialog extends StatelessWidget {
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: UnionFlowColors.unionGreen,
|
||||
foregroundColor: Colors.white,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
||||
elevation: 0,
|
||||
),
|
||||
child: const Text(
|
||||
'Confirmer',
|
||||
style: TextStyle(fontWeight: FontWeight.w700),
|
||||
),
|
||||
child: const Text('Confirmer', style: TextStyle(fontWeight: FontWeight.w700)),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user