From d61e34a1e615e1710771e9e3700dd7882532a5b1 Mon Sep 17 00:00:00 2001 From: Julien Martin Date: Thu, 1 Oct 2026 17:37:40 +0200 Subject: [PATCH] =?UTF-8?q?feat(#173):=20mapping=20type=5Fcode=20=E2=86=92?= =?UTF-8?q?=20teinte=20UI=20(sans=20couleur=20API)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Aqua/bleu/pêche/rose/lavande dérivés du type ; retrait du champ couleur. Co-authored-by: Cursor --- frontend/lib/models/carte_bulle.dart | 49 ++++++++++++---------------- 1 file changed, 21 insertions(+), 28 deletions(-) diff --git a/frontend/lib/models/carte_bulle.dart b/frontend/lib/models/carte_bulle.dart index 13c521e..af27408 100644 --- a/frontend/lib/models/carte_bulle.dart +++ b/frontend/lib/models/carte_bulle.dart @@ -49,7 +49,6 @@ class CarteBulle { final String id; final String typeCode; final String titre; - final String? couleur; final String idPlacement; final String? idAbsence; final String operation; @@ -67,7 +66,6 @@ class CarteBulle { required this.id, required this.typeCode, required this.titre, - this.couleur, required this.idPlacement, this.idAbsence, this.operation = 'create', @@ -96,6 +94,8 @@ class CarteBulle { case 'absence_enfant': case 'absence_enfant_modif': return 'Notification d’absence'; + case 'soin_enfant': + return 'Soin / bobo'; default: return titre; } @@ -103,6 +103,7 @@ class CarteBulle { bool get isArretMaladie => typeCode == 'arret_maladie_am'; bool get isCongeAm => typeCode == 'conge_am'; + bool get isSoinEnfant => typeCode == 'soin_enfant'; /// Icône dessin (haut droite) selon le type de bulle. String? get iconAsset { @@ -114,6 +115,7 @@ class CarteBulle { case 'absence_enfant': case 'absence_enfant_modif': return 'assets/images/cartes/icon_carte_absence.png'; + // soin_enfant : icône selon sous-type payload — à brancher plus tard default: return null; } @@ -137,35 +139,27 @@ class CarteBulle { return !todayDay.isAfter(fin); } - /// Asset horizontal pastel (palette `assets/cards/` uniquement). - String get backgroundAsset { - // Congés : aqua (le lavande API ne convient pas au design). - if (typeCode == 'conge_am') { - return CardColorHorizontal.aqua.path; - } - final key = (couleur ?? '').trim().toLowerCase(); - switch (key) { - case 'red': - return CardColorHorizontal.red.path; - case 'pink': - return CardColorHorizontal.pink.path; - case 'peach': - 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; + /// Teinte pastel UI dérivée du `type_code` (pas de `couleur` API). + /// Voir `docs/32_MINI-SPEC-BULLES-CARTES.md` §4. + CardColorHorizontal get colorFamily { + switch (typeCode) { + case 'conge_am': + return CardColorHorizontal.aqua; + case 'arret_maladie_am': + return CardColorHorizontal.blue; + case 'absence_enfant': + case 'absence_enfant_modif': + return CardColorHorizontal.peach; + case 'soin_enfant': + return CardColorHorizontal.pink; 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). bool get peutRepondre => !isCreator && @@ -178,7 +172,6 @@ class CarteBulle { id: (json['id'] ?? '').toString(), typeCode: (json['type_code'] ?? '').toString(), titre: (json['titre'] ?? json['type_code'] ?? 'Carte').toString(), - couleur: json['couleur']?.toString(), idPlacement: (json['id_placement'] ?? '').toString(), idAbsence: json['id_absence']?.toString(), operation: (json['operation'] ?? 'create').toString(),