feat(#173): mapping type_code → teinte UI (sans couleur API)

Aqua/bleu/pêche/rose/lavande dérivés du type ; retrait du champ couleur.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-10-01 17:37:40 +02:00
co-authored by Cursor
parent 484fb9a3e5
commit d61e34a1e6
+21 -28
View File
@@ -49,7 +49,6 @@ class CarteBulle {
final String id; final String id;
final String typeCode; final String typeCode;
final String titre; final String titre;
final String? couleur;
final String idPlacement; final String idPlacement;
final String? idAbsence; final String? idAbsence;
final String operation; final String operation;
@@ -67,7 +66,6 @@ class CarteBulle {
required this.id, required this.id,
required this.typeCode, required this.typeCode,
required this.titre, required this.titre,
this.couleur,
required this.idPlacement, required this.idPlacement,
this.idAbsence, this.idAbsence,
this.operation = 'create', this.operation = 'create',
@@ -96,6 +94,8 @@ class CarteBulle {
case 'absence_enfant': case 'absence_enfant':
case 'absence_enfant_modif': case 'absence_enfant_modif':
return 'Notification d’absence'; return 'Notification d’absence';
case 'soin_enfant':
return 'Soin / bobo';
default: default:
return titre; return titre;
} }
@@ -103,6 +103,7 @@ class CarteBulle {
bool get isArretMaladie => typeCode == 'arret_maladie_am'; bool get isArretMaladie => typeCode == 'arret_maladie_am';
bool get isCongeAm => typeCode == 'conge_am'; bool get isCongeAm => typeCode == 'conge_am';
bool get isSoinEnfant => typeCode == 'soin_enfant';
/// Icône dessin (haut droite) selon le type de bulle. /// Icône dessin (haut droite) selon le type de bulle.
String? get iconAsset { String? get iconAsset {
@@ -114,6 +115,7 @@ class CarteBulle {
case 'absence_enfant': case 'absence_enfant':
case 'absence_enfant_modif': case 'absence_enfant_modif':
return 'assets/images/cartes/icon_carte_absence.png'; return 'assets/images/cartes/icon_carte_absence.png';
// soin_enfant : icône selon sous-type payload — à brancher plus tard
default: default:
return null; return null;
} }
@@ -137,35 +139,27 @@ class CarteBulle {
return !todayDay.isAfter(fin); return !todayDay.isAfter(fin);
} }
/// Asset horizontal pastel (palette `assets/cards/` uniquement). /// Teinte pastel UI dérivée du `type_code` (pas de `couleur` API).
String get backgroundAsset { /// Voir `docs/32_MINI-SPEC-BULLES-CARTES.md` §4.
// Congés : aqua (le lavande API ne convient pas au design). CardColorHorizontal get colorFamily {
if (typeCode == 'conge_am') { switch (typeCode) {
return CardColorHorizontal.aqua.path; case 'conge_am':
} return CardColorHorizontal.aqua;
final key = (couleur ?? '').trim().toLowerCase(); case 'arret_maladie_am':
switch (key) { return CardColorHorizontal.blue;
case 'red': case 'absence_enfant':
return CardColorHorizontal.red.path; case 'absence_enfant_modif':
case 'pink': return CardColorHorizontal.peach;
return CardColorHorizontal.pink.path; case 'soin_enfant':
case 'peach': return CardColorHorizontal.pink;
return CardColorHorizontal.peach.path;
case 'lime':
return CardColorHorizontal.lime.path;
case 'lavender':
return CardColorHorizontal.lavender.path;
case 'green':
return CardColorHorizontal.green.path;
case 'blue':
return CardColorHorizontal.blue.path;
case 'aqua':
return CardColorHorizontal.aqua.path;
default: default:
return CardColorHorizontal.peach.path; return CardColorHorizontal.lavender;
} }
} }
/// Asset horizontal pastel (palette `assets/cards/` uniquement).
String get backgroundAsset => colorFamily.path;
/// Le destinataire peut répondre (pas le créateur, carte ouverte). /// Le destinataire peut répondre (pas le créateur, carte ouverte).
bool get peutRepondre => bool get peutRepondre =>
!isCreator && !isCreator &&
@@ -178,7 +172,6 @@ class CarteBulle {
id: (json['id'] ?? '').toString(), id: (json['id'] ?? '').toString(),
typeCode: (json['type_code'] ?? '').toString(), typeCode: (json['type_code'] ?? '').toString(),
titre: (json['titre'] ?? json['type_code'] ?? 'Carte').toString(), titre: (json['titre'] ?? json['type_code'] ?? 'Carte').toString(),
couleur: json['couleur']?.toString(),
idPlacement: (json['id_placement'] ?? '').toString(), idPlacement: (json['id_placement'] ?? '').toString(),
idAbsence: json['id_absence']?.toString(), idAbsence: json['id_absence']?.toString(),
operation: (json['operation'] ?? 'create').toString(), operation: (json['operation'] ?? 'create').toString(),