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:
@@ -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(),
|
||||
|
||||
Reference in New Issue
Block a user