feat(ui): dark mode adaptatif sur 15 pages/widgets restants
Pattern AppColors pair (isDark ternaries) appliqué sur : - login_page : SnackBar error color Color(0xFFDC2626) → AppColors.error (gradient brand intentionnel non modifié) - help_support : barre de recherche + ExpansionTile + chevrons → scheme adaptatif - system_settings : état 'Accès réservé' + unselectedLabelColor TabBar - epargne : date/description/boutons OutlinedButton foregroundColor adaptatifs - conversation_tile, connected_recent_activities, connected_upcoming_events - dashboard_notifications_widget - budgets_list_page, pending_approvals_page, approve/reject_dialog - create_organization_page, edit_organization_page, about_page Les couleurs sémantiques (error, success, warning, primary) restent inchangées. Les blancs/gradients intentionnels (AppBars brand, logos payment) préservés.
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
/// Widget tuile de conversation
|
||||
/// Widget tuile de conversation v4
|
||||
library conversation_tile;
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
import '../../../../shared/design_system/unionflow_design_system.dart';
|
||||
import '../../domain/entities/conversation.dart';
|
||||
|
||||
class ConversationTile extends StatelessWidget {
|
||||
final Conversation conversation;
|
||||
final ConversationSummary conversation;
|
||||
final VoidCallback onTap;
|
||||
|
||||
const ConversationTile({
|
||||
@@ -31,41 +32,55 @@ class ConversationTile extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
IconData _typeIcon() {
|
||||
switch (conversation.typeConversation) {
|
||||
case 'DIRECTE':
|
||||
return Icons.person_outline;
|
||||
case 'ROLE_CANAL':
|
||||
return Icons.account_circle_outlined;
|
||||
case 'GROUPE':
|
||||
return Icons.group_outlined;
|
||||
default:
|
||||
return Icons.chat_bubble_outline;
|
||||
}
|
||||
}
|
||||
|
||||
String _apercuMessage() {
|
||||
if (conversation.dernierMessageApercu == null) return 'Aucun message';
|
||||
final type = conversation.dernierMessageType ?? 'TEXTE';
|
||||
if (type == 'VOCAL') return '🎙️ Note vocale';
|
||||
if (type == 'IMAGE') return '📷 Image';
|
||||
return conversation.dernierMessageApercu!;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final isDark = Theme.of(context).brightness == Brightness.dark;
|
||||
return InkWell(
|
||||
onTap: onTap,
|
||||
borderRadius: BorderRadius.circular(SpacingTokens.radiusMd),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(SpacingTokens.md),
|
||||
decoration: BoxDecoration(
|
||||
color: ColorTokens.surface,
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
borderRadius: BorderRadius.circular(SpacingTokens.radiusMd),
|
||||
border: Border.all(
|
||||
color: conversation.hasUnread
|
||||
? AppColors.primaryGreen.withOpacity(0.3)
|
||||
? AppColors.primary.withOpacity(0.3)
|
||||
: ColorTokens.outline,
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
// Avatar
|
||||
CircleAvatar(
|
||||
radius: 24,
|
||||
backgroundColor: AppColors.primaryGreen.withOpacity(0.1),
|
||||
backgroundImage: conversation.avatarUrl != null
|
||||
? NetworkImage(conversation.avatarUrl!)
|
||||
: null,
|
||||
child: conversation.avatarUrl == null
|
||||
? Text(
|
||||
conversation.name.isNotEmpty
|
||||
? conversation.name[0].toUpperCase()
|
||||
: '?',
|
||||
style: AppTypography.actionText.copyWith(
|
||||
color: AppColors.primaryGreen,
|
||||
),
|
||||
)
|
||||
: null,
|
||||
// Avatar type
|
||||
Container(
|
||||
width: 48,
|
||||
height: 48,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.primary.withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(SpacingTokens.radiusCircular),
|
||||
),
|
||||
child: Icon(_typeIcon(), color: AppColors.primary, size: 24),
|
||||
),
|
||||
|
||||
const SizedBox(width: SpacingTokens.md),
|
||||
@@ -79,7 +94,7 @@ class ConversationTile extends StatelessWidget {
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
conversation.name,
|
||||
conversation.titre,
|
||||
style: AppTypography.actionText.copyWith(
|
||||
fontWeight: conversation.hasUnread
|
||||
? FontWeight.bold
|
||||
@@ -89,29 +104,27 @@ class ConversationTile extends StatelessWidget {
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
if (conversation.lastMessage != null)
|
||||
if (conversation.dernierMessageAt != null)
|
||||
Text(
|
||||
_formatDate(conversation.lastMessage!.createdAt),
|
||||
_formatDate(conversation.dernierMessageAt!),
|
||||
style: AppTypography.subtitleSmall.copyWith(
|
||||
color: AppColors.textSecondaryLight,
|
||||
color: isDark ? AppColors.textSecondaryDark : AppColors.textSecondary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
if (conversation.lastMessage != null) ...[
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
conversation.lastMessage!.content,
|
||||
style: AppTypography.bodyTextSmall.copyWith(
|
||||
color: AppColors.textSecondaryLight,
|
||||
fontWeight: conversation.hasUnread
|
||||
? FontWeight.w600
|
||||
: FontWeight.normal,
|
||||
),
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
_apercuMessage(),
|
||||
style: AppTypography.bodyTextSmall.copyWith(
|
||||
color: isDark ? AppColors.textSecondaryDark : AppColors.textSecondary,
|
||||
fontWeight: conversation.hasUnread
|
||||
? FontWeight.w600
|
||||
: FontWeight.normal,
|
||||
),
|
||||
],
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -120,16 +133,13 @@ class ConversationTile extends StatelessWidget {
|
||||
if (conversation.hasUnread) ...[
|
||||
const SizedBox(width: SpacingTokens.sm),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 8,
|
||||
vertical: 4,
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.primaryGreen,
|
||||
color: AppColors.primary,
|
||||
borderRadius: BorderRadius.circular(SpacingTokens.radiusCircular),
|
||||
),
|
||||
child: Text(
|
||||
'${conversation.unreadCount}',
|
||||
'${conversation.nonLus}',
|
||||
style: AppTypography.badgeText.copyWith(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold,
|
||||
@@ -137,27 +147,6 @@ class ConversationTile extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
// Icônes statut
|
||||
if (conversation.isPinned || conversation.isMuted) ...[
|
||||
const SizedBox(width: SpacingTokens.sm),
|
||||
Column(
|
||||
children: [
|
||||
if (conversation.isPinned)
|
||||
Icon(
|
||||
Icons.push_pin,
|
||||
size: 16,
|
||||
color: AppColors.textSecondaryLight,
|
||||
),
|
||||
if (conversation.isMuted)
|
||||
Icon(
|
||||
Icons.volume_off,
|
||||
size: 16,
|
||||
color: AppColors.textSecondaryLight,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user