Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
95e787edef | ||
|
|
1047e94363 | ||
|
|
1678ea6c0b | ||
|
|
b35ca8dc8a | ||
|
|
64c78eef30 | ||
|
|
6884eb0752 | ||
|
|
130d6e8d73 | ||
|
|
f1f09617a0 | ||
|
|
bd85f7792b | ||
|
|
fadfde1017 |
@@ -103,7 +103,7 @@ Avec données peuplées, sur au moins 2 supports :
|
||||
|
||||
- Parent : `frontend/lib/screens/home/parent_screen/ParentDashboardScreen.dart` + `dashbord_parent/`
|
||||
- AM : `frontend/lib/screens/am/am_dashboard_screen.dart` (placeholder)
|
||||
- Cartes couleurs : `frontend/assets/cards/` (7 teintes max)
|
||||
- Cartes couleurs : `frontend/assets/cards/` (8 teintes max)
|
||||
|
||||
## 9. Ordre de build suggéré
|
||||
|
||||
|
||||
@@ -0,0 +1,159 @@
|
||||
# Mini-spec · Bulles / file d’attention (#173)
|
||||
|
||||
*Front · octobre 2026 — pour alignement backend (garant de la spec API).*
|
||||
|
||||
---
|
||||
|
||||
## 1. Contexte / objectif
|
||||
|
||||
Les bulles (cartes) sont la **file d’attention** du quotidien parent / AM : décisions et infos proches (congés, arrêt maladie, absences, plus tard soins / admin).
|
||||
|
||||
Cette note formalise :
|
||||
1. **Ce qui est déjà en place côté front** (branche `feature/173-feed-bulles-parent`).
|
||||
2. La **palette sémantique** retenue (couleur = famille).
|
||||
3. Les **évolutions API** souhaitées pour que le back pousse les bonnes `couleur` / types.
|
||||
4. Les **idées de bulles futures** (non branchées).
|
||||
|
||||
Les cartes restent une **mémoire courte** (`purge_at`) ; la source de vérité absences / congés reste `absences_garde` (voir `31_MINI-SPEC-QUOTIDIEN-PARENT-AM.md`).
|
||||
|
||||
---
|
||||
|
||||
## 2. Contrat API actuel (rappel)
|
||||
|
||||
Endpoint principal : `GET /api/v1/cards` (filtre couple / placement).
|
||||
|
||||
Champs utiles côté UI :
|
||||
|
||||
| Champ | Rôle UI |
|
||||
|-------|---------|
|
||||
| `type_code` | Layout + libellé sémantique + icône |
|
||||
| `couleur` | Teinte du fond pastel (`assets/cards/card_*_h.png`) |
|
||||
| `titre` | Fallback si `type_code` inconnu |
|
||||
| `statut` | `ouverte` · `refusee` · `traitee` |
|
||||
| `response_mode` | `none` · `ack` · `accept_refuse` |
|
||||
| `is_creator` | Masque les boutons réponse pour le créateur |
|
||||
| `payload.date_debut` / `date_fin` | Période affichée |
|
||||
| `payload.motif` | Non affiché sur la maquette congés actuelle |
|
||||
| `last_refuse_comment` | Affiché si `refusee` |
|
||||
| `id_absence` | Lien métier absence / congé |
|
||||
| `purge_at` | Péremption file |
|
||||
|
||||
**Règle front actuelle :** le destinataire peut répondre si `!is_creator && statut == ouverte && response_mode != none`.
|
||||
|
||||
---
|
||||
|
||||
## 3. Évolutions front déjà livrées (#173)
|
||||
|
||||
### 3.1 Feed
|
||||
|
||||
- Widget partagé `CartesFeed` (parent + AM).
|
||||
- Fond carte via widget `Carte` (bandeau / 9-slice horizontal).
|
||||
- Dégradés haut / bas sur la liste scrollable.
|
||||
- Plus de libellés « À traiter / Traité » : actions via **modales** accepter / refuser / ack.
|
||||
- Libellés UI sémantiques (indépendants du `titre` API brut) :
|
||||
- `conge_am` → « Demande de congés »
|
||||
- `arret_maladie_am` → « Arrêt maladie »
|
||||
- `absence_enfant` (+ `_modif`) → « Notification d’absence »
|
||||
|
||||
### 3.2 Carte **congés** (`conge_am`) — maquette validée
|
||||
|
||||
| Élément | Comportement |
|
||||
|---------|----------------|
|
||||
| Fond | **Aqua** forcé côté front (même si l’API envoie encore `lavender`) |
|
||||
| Encre | Pétrole désaturé `#315F63` (titre) ; date un peu plus claire `#4A7276` ; lien `#2B5868` |
|
||||
| Icône | Valise `assets/images/valise.png` |
|
||||
| Période | Une ligne type « Du 04 au 06 novembre 2026 » + petite icône calendrier |
|
||||
| Actions | Pilules peintes ✓ vert / ✕ corail (`btn_coche_pilule` / `btn_croix_pilule`) si `accept_refuse` |
|
||||
| Lien | « Ouvrir dans l’agenda ↗ » (stub UI pour l’instant) |
|
||||
| Opacité | Carte atténuée si `traitee` (sauf règle arrêt maladie ci-dessous) |
|
||||
|
||||
### 3.3 Arrêt maladie (`arret_maladie_am`)
|
||||
|
||||
- Reste **visible / opaque** tant que la période n’est pas finie (`date_fin` jour inclus), même si `statut == traitee`.
|
||||
- Icône thermomètre (asset dédié). Fond encore piloté par `couleur` API (cible produit : **bleu** — voir §4).
|
||||
|
||||
### 3.4 Assets couleurs horizontales
|
||||
|
||||
Teintes dispo dans `frontend/assets/cards/` (V + H), dont **`aqua`** ajouté pour les congés.
|
||||
|
||||
Clés API reconnues côté front : `red` · `pink` · `peach` · `lime` · `lavender` · `green` · `blue` · **`aqua`**. Défaut UI si inconnu : `peach`.
|
||||
|
||||
---
|
||||
|
||||
## 4. Palette sémantique (alignement demandé)
|
||||
|
||||
| Couleur API (`couleur`) | Famille | Types / exemples |
|
||||
|-------------------------|---------|------------------|
|
||||
| **`aqua`** | Congés | `conge_am` |
|
||||
| **`blue`** | Arrêt maladie | `arret_maladie_am` |
|
||||
| **`pink`** | Soins du quotidien | médicament, température, bobo, crème… (futur) |
|
||||
| **`peach`** | Absence / info pratique | `absence_enfant`, `absence_enfant_modif` |
|
||||
| **`lavender`** | Administratif / autre | infos admin, divers (à utiliser avec parcimonie) |
|
||||
|
||||
**Principes**
|
||||
|
||||
- La **couleur** = famille (lisible sans lire tout le texte).
|
||||
- L’**icône** précise l’action (surtout sur fond rose : thermomètre, flacon, pansement, croix de soin…).
|
||||
- Rose = doux / rassurant, **pas** une alerte médicale forte.
|
||||
- Éviter le lavande pour les congés (trop « admin », dissonant avec valise / aqua).
|
||||
|
||||
### Demande backend (prioritaire)
|
||||
|
||||
1. Seeds / création de cartes : `conge_am` → `couleur: "aqua"` (le front force déjà ; l’API devrait être source de vérité).
|
||||
2. `arret_maladie_am` → `couleur: "blue"`.
|
||||
3. `absence_enfant*` → `couleur: "peach"`.
|
||||
4. Documenter les valeurs autorisées de `couleur` (enum / check) pour inclure `aqua`.
|
||||
5. Ne plus mapper les congés sur `lavender`.
|
||||
|
||||
---
|
||||
|
||||
## 5. Idées de bulles futures (hors scope #173)
|
||||
|
||||
Non implémentées ; pour anticipation contrat types + couleurs.
|
||||
|
||||
| Famille | Couleur | Exemples de `type_code` (propositions) | `response_mode` typique | Icônes (ex.) |
|
||||
|---------|---------|----------------------------------------|-------------------------|--------------|
|
||||
| Soins | `pink` | `soin_temperature`, `soin_medicament`, `soin_bobo`, `soin_creme` | `ack` (parent) | thermomètre, flacon, pansement, tube |
|
||||
| Sortie / autorisation | `peach` ou `lavender` | `sortie_a_valider` | `accept_refuse` | à définir |
|
||||
| Admin | `lavender` | `info_admin`, `document_a_fournir` | `ack` / `none` | classeur, tampon |
|
||||
| Congé / maladie (évol.) | `aqua` / `blue` | modif période, annulation | selon métier | valise / thermomètre |
|
||||
|
||||
**Variante soins :** un seul fond rose ; l’icône change selon l’événement — la famille « santé/soin » reste immédiate.
|
||||
|
||||
---
|
||||
|
||||
## 6. Comportements métier à ne pas casser
|
||||
|
||||
- Créateur : pas de boutons réponse ; éventuel libellé « En attente de réponse ».
|
||||
- Refus : afficher `last_refuse_comment` si présent.
|
||||
- Congé : `accept_refuse` côté destinataire.
|
||||
- Absence enfant : souvent info / ack (pas de veto AM en V1 — voir mini-spec quotidien).
|
||||
- Péremption : respecter `purge_at` / retention ; pas un historique long.
|
||||
|
||||
---
|
||||
|
||||
## 7. Fichiers front de référence
|
||||
|
||||
- `frontend/lib/models/carte_bulle.dart` — mapping type → libellé / icône / fond
|
||||
- `frontend/lib/widgets/quotidien/cartes_feed.dart` — layout feed + carte congés
|
||||
- `frontend/lib/models/card_assets.dart` — enum teintes dont `aqua`
|
||||
- Assets : `frontend/assets/cards/card_aqua(_h).png`, `frontend/assets/images/valise.png`, `frontend/assets/images/cartes/btn_*_pilule.png`
|
||||
|
||||
---
|
||||
|
||||
## 8. Non-régression / recettes suggérées (back + front)
|
||||
|
||||
- [ ] Carte `conge_am` créée avec `couleur=aqua` (et lisible si encore lavande côté vieux seeds grâce au forçage front).
|
||||
- [ ] Accept / refuse congé → statut + commentaire refus.
|
||||
- [ ] Arrêt maladie traité mais période en cours → reste visible côté destinataire.
|
||||
- [ ] Filtre couple / placement : une seule file pour le couple actif.
|
||||
- [ ] Aucune régression sur `absence_enfant` (création parent → bulle AM).
|
||||
|
||||
---
|
||||
|
||||
## 9. Références
|
||||
|
||||
- Ticket front : **#173**
|
||||
- Contrat cartes / réponses : **#194** (si applicable)
|
||||
- Quotidien parent–AM : `docs/31_MINI-SPEC-QUOTIDIEN-PARENT-AM.md`
|
||||
- Maquette congés : `ressources/bulle_congés.jpg`
|
||||
|
After Width: | Height: | Size: 741 KiB |
|
After Width: | Height: | Size: 692 KiB |
|
After Width: | Height: | Size: 195 KiB |
|
After Width: | Height: | Size: 231 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 659 KiB After Width: | Height: | Size: 1.2 MiB |
|
Before Width: | Height: | Size: 268 KiB After Width: | Height: | Size: 1.1 MiB |
|
After Width: | Height: | Size: 365 KiB |
@@ -1,5 +1,3 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
enum CardColorVertical {
|
||||
red('assets/cards/card_red.png'),
|
||||
pink('assets/cards/card_pink.png'),
|
||||
@@ -7,7 +5,8 @@ enum CardColorVertical {
|
||||
lime('assets/cards/card_lime.png'),
|
||||
lavender('assets/cards/card_lavender.png'),
|
||||
green('assets/cards/card_green.png'),
|
||||
blue('assets/cards/card_blue.png');
|
||||
blue('assets/cards/card_blue.png'),
|
||||
aqua('assets/cards/card_aqua.png');
|
||||
|
||||
final String path;
|
||||
const CardColorVertical(this.path);
|
||||
@@ -20,7 +19,8 @@ enum CardColorHorizontal {
|
||||
lime('assets/cards/card_lime_h.png'),
|
||||
lavender('assets/cards/card_lavender_h.png'),
|
||||
green('assets/cards/card_green_h.png'),
|
||||
blue('assets/cards/card_blue_h.png');
|
||||
blue('assets/cards/card_blue_h.png'),
|
||||
aqua('assets/cards/card_aqua_h.png');
|
||||
|
||||
final String path;
|
||||
const CardColorHorizontal(this.path);
|
||||
|
||||
@@ -108,7 +108,7 @@ class CarteBulle {
|
||||
String? get iconAsset {
|
||||
switch (typeCode) {
|
||||
case 'conge_am':
|
||||
return 'assets/images/cartes/icon_carte_conges2.png';
|
||||
return 'assets/images/valise.png';
|
||||
case 'arret_maladie_am':
|
||||
return 'assets/images/cartes/icon_carte_maladie.png';
|
||||
case 'absence_enfant':
|
||||
@@ -139,6 +139,10 @@ class CarteBulle {
|
||||
|
||||
/// 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':
|
||||
@@ -155,6 +159,8 @@ class CarteBulle {
|
||||
return CardColorHorizontal.green.path;
|
||||
case 'blue':
|
||||
return CardColorHorizontal.blue.path;
|
||||
case 'aqua':
|
||||
return CardColorHorizontal.aqua.path;
|
||||
default:
|
||||
return CardColorHorizontal.peach.path;
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ class _ParentRegisterStep3ScreenState extends State<ParentRegisterStep3Screen> {
|
||||
CardColorVertical.red,
|
||||
CardColorVertical.green,
|
||||
CardColorVertical.blue,
|
||||
CardColorVertical.aqua,
|
||||
];
|
||||
|
||||
// Garder une trace des couleurs déjà utilisées
|
||||
|
||||
@@ -17,6 +17,7 @@ class RepriseMapper {
|
||||
CardColorVertical.red,
|
||||
CardColorVertical.green,
|
||||
CardColorVertical.blue,
|
||||
CardColorVertical.aqua,
|
||||
];
|
||||
|
||||
static ParentData parentFromDossier(ParentDossier p) {
|
||||
|
||||
@@ -185,6 +185,8 @@ class BaseFormScreen extends StatelessWidget {
|
||||
return CardColorVertical.pink.path;
|
||||
case CardColorHorizontal.red:
|
||||
return CardColorVertical.red.path;
|
||||
case CardColorHorizontal.aqua:
|
||||
return CardColorVertical.aqua.path;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -205,9 +205,14 @@ class _ChildCardWidgetState extends State<ChildCardWidget> {
|
||||
);
|
||||
}
|
||||
|
||||
final Color baseCardColorForShadow = widget.childData.cardColor == CardColorVertical.lavender
|
||||
? Colors.purple.shade200
|
||||
: (widget.childData.cardColor == CardColorVertical.pink ? Colors.pink.shade200 : Colors.grey.shade200);
|
||||
final Color baseCardColorForShadow =
|
||||
widget.childData.cardColor == CardColorVertical.lavender
|
||||
? Colors.purple.shade200
|
||||
: (widget.childData.cardColor == CardColorVertical.pink
|
||||
? Colors.pink.shade200
|
||||
: (widget.childData.cardColor == CardColorVertical.aqua
|
||||
? Colors.teal.shade200
|
||||
: Colors.grey.shade200));
|
||||
final double photoSide = 200.0 * (config.isMobile ? 0.8 : 1.0);
|
||||
final double editableCardWidth = config.isMobile
|
||||
? double.infinity
|
||||
@@ -340,6 +345,7 @@ class _ChildCardWidgetState extends State<ChildCardWidget> {
|
||||
|
||||
// Mapping manuel simple
|
||||
if (widget.childData.cardColor.path.contains('lavender')) horizontalCardAsset = CardColorHorizontal.lavender.path;
|
||||
else if (widget.childData.cardColor.path.contains('aqua')) horizontalCardAsset = CardColorHorizontal.aqua.path;
|
||||
else if (widget.childData.cardColor.path.contains('blue')) horizontalCardAsset = CardColorHorizontal.blue.path;
|
||||
else if (widget.childData.cardColor.path.contains('green')) horizontalCardAsset = CardColorHorizontal.green.path;
|
||||
else if (widget.childData.cardColor.path.contains('lime')) horizontalCardAsset = CardColorHorizontal.lime.path;
|
||||
|
||||
@@ -1302,6 +1302,8 @@ class _PersonalInfoFormScreenState extends State<PersonalInfoFormScreen> {
|
||||
return CardColorVertical.pink.path;
|
||||
case CardColorHorizontal.red:
|
||||
return CardColorVertical.red.path;
|
||||
case CardColorHorizontal.aqua:
|
||||
return CardColorVertical.aqua.path;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -642,6 +642,8 @@ class _PresentationFormScreenState extends State<PresentationFormScreen> {
|
||||
return CardColorVertical.pink.path;
|
||||
case CardColorHorizontal.red:
|
||||
return CardColorVertical.red.path;
|
||||
case CardColorHorizontal.aqua:
|
||||
return CardColorVertical.aqua.path;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1196,6 +1196,8 @@ class _ProfessionalInfoFormScreenState extends State<ProfessionalInfoFormScreen>
|
||||
return CardColorVertical.pink.path;
|
||||
case CardColorHorizontal.red:
|
||||
return CardColorVertical.red.path;
|
||||
case CardColorHorizontal.aqua:
|
||||
return CardColorVertical.aqua.path;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,17 +22,32 @@ class CartesFeed extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _CartesFeedState extends State<CartesFeed> {
|
||||
static const double _fadeExtent = 0.08;
|
||||
|
||||
List<CarteBulle> _items = const [];
|
||||
bool _loading = true;
|
||||
String? _error;
|
||||
String? _busyCardId;
|
||||
|
||||
final ScrollController _scrollController = ScrollController();
|
||||
bool _isScrollable = false;
|
||||
bool _fadeTop = false;
|
||||
bool _fadeBottom = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_scrollController.addListener(_syncScrollFades);
|
||||
_load();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_scrollController.removeListener(_syncScrollFades);
|
||||
_scrollController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
void didUpdateWidget(covariant CartesFeed oldWidget) {
|
||||
super.didUpdateWidget(oldWidget);
|
||||
@@ -41,6 +56,25 @@ class _CartesFeedState extends State<CartesFeed> {
|
||||
}
|
||||
}
|
||||
|
||||
void _syncScrollFades() {
|
||||
if (!_scrollController.hasClients) return;
|
||||
final position = _scrollController.position;
|
||||
final scrollable = position.maxScrollExtent > 0.0;
|
||||
final threshold = position.viewportDimension * _fadeExtent / 2;
|
||||
final fadeTop = scrollable && position.pixels > threshold;
|
||||
final fadeBottom = scrollable &&
|
||||
position.pixels < (position.maxScrollExtent - threshold);
|
||||
if (scrollable != _isScrollable ||
|
||||
fadeTop != _fadeTop ||
|
||||
fadeBottom != _fadeBottom) {
|
||||
setState(() {
|
||||
_isScrollable = scrollable;
|
||||
_fadeTop = fadeTop;
|
||||
_fadeBottom = fadeBottom;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _load() async {
|
||||
setState(() {
|
||||
_loading = true;
|
||||
@@ -55,6 +89,7 @@ class _CartesFeedState extends State<CartesFeed> {
|
||||
_items = items;
|
||||
_loading = false;
|
||||
});
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) => _syncScrollFades());
|
||||
} catch (e) {
|
||||
if (!mounted) return;
|
||||
setState(() {
|
||||
@@ -304,28 +339,79 @@ class _CartesFeedState extends State<CartesFeed> {
|
||||
);
|
||||
}
|
||||
|
||||
return RefreshIndicator(
|
||||
onRefresh: _load,
|
||||
child: ListView.separated(
|
||||
padding: const EdgeInsets.only(bottom: 8),
|
||||
itemCount: _items.length,
|
||||
separatorBuilder: (_, __) => const SizedBox(height: 10),
|
||||
itemBuilder: (context, index) {
|
||||
final card = _items[index];
|
||||
return _BulleTile(
|
||||
card: card,
|
||||
busy: _busyCardId == card.id,
|
||||
onAccept: () => _onAccept(card),
|
||||
onAck: () => _onAck(card),
|
||||
onRefuse: () => _onRefuse(card),
|
||||
);
|
||||
return NotificationListener<ScrollMetricsNotification>(
|
||||
onNotification: (_) {
|
||||
_syncScrollFades();
|
||||
return false;
|
||||
},
|
||||
child: ShaderMask(
|
||||
blendMode: BlendMode.dstIn,
|
||||
shaderCallback: (Rect bounds) {
|
||||
final stops = <double>[
|
||||
0.0,
|
||||
_fadeExtent,
|
||||
1.0 - _fadeExtent,
|
||||
1.0,
|
||||
];
|
||||
if (!_isScrollable) {
|
||||
return const LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
colors: <Color>[
|
||||
Colors.black,
|
||||
Colors.black,
|
||||
Colors.black,
|
||||
Colors.black,
|
||||
],
|
||||
stops: [0.0, 0.08, 0.92, 1.0],
|
||||
).createShader(bounds);
|
||||
}
|
||||
final topMask = _fadeTop ? Colors.transparent : Colors.black;
|
||||
final bottomMask = _fadeBottom ? Colors.transparent : Colors.black;
|
||||
return LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
colors: <Color>[
|
||||
topMask,
|
||||
Colors.black,
|
||||
Colors.black,
|
||||
bottomMask,
|
||||
],
|
||||
stops: stops,
|
||||
).createShader(bounds);
|
||||
},
|
||||
child: RefreshIndicator(
|
||||
onRefresh: _load,
|
||||
child: ListView.separated(
|
||||
controller: _scrollController,
|
||||
padding: const EdgeInsets.only(top: 4, bottom: 8),
|
||||
itemCount: _items.length,
|
||||
separatorBuilder: (_, __) => const SizedBox(height: 10),
|
||||
itemBuilder: (context, index) {
|
||||
final card = _items[index];
|
||||
return _BulleTile(
|
||||
card: card,
|
||||
busy: _busyCardId == card.id,
|
||||
onAccept: () => _onAccept(card),
|
||||
onAck: () => _onAck(card),
|
||||
onRefuse: () => _onRefuse(card),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _BulleTile extends StatelessWidget {
|
||||
/// Encre aqua foncé — harmonisée fond aqua / valise (pas le violet).
|
||||
static const Color _aquaInk = Color(0xFF315F63);
|
||||
/// Date : même famille, ~12 % plus claire.
|
||||
static const Color _aquaDate = Color(0xFF4A7276);
|
||||
/// Lien agenda : légère dérive bleue.
|
||||
static const Color _aquaLink = Color(0xFF2B5868);
|
||||
|
||||
final CarteBulle card;
|
||||
final bool busy;
|
||||
final VoidCallback onAccept;
|
||||
@@ -340,26 +426,51 @@ class _BulleTile extends StatelessWidget {
|
||||
required this.onRefuse,
|
||||
});
|
||||
|
||||
static const _mois = [
|
||||
'janvier',
|
||||
'février',
|
||||
'mars',
|
||||
'avril',
|
||||
'mai',
|
||||
'juin',
|
||||
'juillet',
|
||||
'août',
|
||||
'septembre',
|
||||
'octobre',
|
||||
'novembre',
|
||||
'décembre',
|
||||
];
|
||||
|
||||
String _fmtLong(String? iso) {
|
||||
if (iso == null || iso.isEmpty) return '…';
|
||||
final dt = DateTime.tryParse(iso);
|
||||
if (dt == null) return iso;
|
||||
const mois = [
|
||||
'janvier',
|
||||
'février',
|
||||
'mars',
|
||||
'avril',
|
||||
'mai',
|
||||
'juin',
|
||||
'juillet',
|
||||
'août',
|
||||
'septembre',
|
||||
'octobre',
|
||||
'novembre',
|
||||
'décembre',
|
||||
];
|
||||
final jj = dt.day.toString().padLeft(2, '0');
|
||||
return '$jj ${mois[dt.month - 1]} ${dt.year}';
|
||||
return '$jj ${_mois[dt.month - 1]} ${dt.year}';
|
||||
}
|
||||
|
||||
/// Une ligne type maquette : « Du 04 au 06 novembre 2026 ».
|
||||
String _fmtPeriodeUneLigne() {
|
||||
final d1 = DateTime.tryParse(card.dateDebut ?? '');
|
||||
final d2 = DateTime.tryParse(card.dateFin ?? '');
|
||||
if (d1 == null && d2 == null) return '';
|
||||
if (d1 != null && d2 == null) return 'Le ${_fmtLong(card.dateDebut)}';
|
||||
if (d1 == null && d2 != null) return 'Au ${_fmtLong(card.dateFin)}';
|
||||
final a = d1!;
|
||||
final b = d2!;
|
||||
final j1 = a.day.toString().padLeft(2, '0');
|
||||
final j2 = b.day.toString().padLeft(2, '0');
|
||||
if (a.year == b.year && a.month == b.month && a.day == b.day) {
|
||||
return 'Le $j1 ${_mois[a.month - 1]} ${a.year}';
|
||||
}
|
||||
if (a.year == b.year && a.month == b.month) {
|
||||
return 'Du $j1 au $j2 ${_mois[a.month - 1]} ${a.year}';
|
||||
}
|
||||
if (a.year == b.year) {
|
||||
return 'Du $j1 ${_mois[a.month - 1]} au $j2 ${_mois[b.month - 1]} ${a.year}';
|
||||
}
|
||||
return 'Du $j1 ${_mois[a.month - 1]} ${a.year} '
|
||||
'au $j2 ${_mois[b.month - 1]} ${b.year}';
|
||||
}
|
||||
|
||||
/// Arrêt maladie : reste opaque tant que la période n’est pas finie.
|
||||
@@ -370,6 +481,175 @@ class _BulleTile extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (card.isCongeAm) return _buildConge(context);
|
||||
return _buildGeneric(context);
|
||||
}
|
||||
|
||||
Widget _buildConge(BuildContext context) {
|
||||
final periode = _fmtPeriodeUneLigne();
|
||||
|
||||
return Opacity(
|
||||
opacity: _attenuee ? 0.55 : 1,
|
||||
child: Carte(
|
||||
assetPath: card.backgroundAsset,
|
||||
constraints: const BoxConstraints(minHeight: 140),
|
||||
padding: const EdgeInsets.fromLTRB(22, 18, 18, 14),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
card.titreAffiche,
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: GoogleFonts.merienda(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: _aquaInk,
|
||||
),
|
||||
),
|
||||
if (periode.isNotEmpty) ...[
|
||||
const SizedBox(height: 10),
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Image.asset(
|
||||
'assets/images/cartes/icon_calendrier_crayon.png',
|
||||
width: 28,
|
||||
height: 28,
|
||||
fit: BoxFit.contain,
|
||||
filterQuality: FilterQuality.high,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Text(
|
||||
periode,
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: GoogleFonts.merienda(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: _aquaDate,
|
||||
height: 1.25,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
if (card.statut == CarteStatut.refusee) ...[
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
card.lastRefuseComment != null &&
|
||||
card.lastRefuseComment!.trim().isNotEmpty
|
||||
? 'Refusé — ${card.lastRefuseComment}'
|
||||
: 'Refusé',
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: GoogleFonts.merriweather(
|
||||
fontSize: 12,
|
||||
fontStyle: FontStyle.italic,
|
||||
color: _aquaInk,
|
||||
),
|
||||
),
|
||||
] else if (card.statut == CarteStatut.ouverte &&
|
||||
card.isCreator) ...[
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
'En attente de réponse',
|
||||
style: GoogleFonts.merriweather(
|
||||
fontSize: 12,
|
||||
color: QuotidienTheme.muted,
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
if (card.iconAsset != null) ...[
|
||||
const SizedBox(width: 8),
|
||||
Image.asset(
|
||||
card.iconAsset!,
|
||||
width: 72,
|
||||
height: 72,
|
||||
fit: BoxFit.contain,
|
||||
filterQuality: FilterQuality.high,
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
if (card.peutRepondre)
|
||||
busy
|
||||
? const SizedBox(
|
||||
width: 28,
|
||||
height: 28,
|
||||
child: CircularProgressIndicator(strokeWidth: 2),
|
||||
)
|
||||
: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
_PilulePeinteButton(
|
||||
asset:
|
||||
'assets/images/cartes/btn_coche_pilule.png',
|
||||
tooltip: 'Accepter',
|
||||
onTap: onAccept,
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
_PilulePeinteButton(
|
||||
asset:
|
||||
'assets/images/cartes/btn_croix_pilule.png',
|
||||
tooltip: 'Refuser',
|
||||
onTap: onRefuse,
|
||||
),
|
||||
],
|
||||
),
|
||||
const Spacer(),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text('Agenda — à venir.'),
|
||||
duration: Duration(seconds: 2),
|
||||
),
|
||||
);
|
||||
},
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 4,
|
||||
vertical: 4,
|
||||
),
|
||||
child: Text(
|
||||
'Ouvrir dans l’agenda ↗',
|
||||
style: GoogleFonts.merienda(
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: _aquaLink,
|
||||
decoration: TextDecoration.underline,
|
||||
decorationColor: _aquaLink,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildGeneric(BuildContext context) {
|
||||
final memeJour = card.dateDebut != null &&
|
||||
card.dateFin != null &&
|
||||
card.dateDebut == card.dateFin;
|
||||
@@ -384,22 +664,66 @@ class _BulleTile extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
card.titreAffiche,
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: GoogleFonts.merienda(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: QuotidienTheme.ink,
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
card.titreAffiche,
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: GoogleFonts.merienda(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: QuotidienTheme.ink,
|
||||
),
|
||||
),
|
||||
if (card.dateDebut != null || card.dateFin != null) ...[
|
||||
const SizedBox(height: 10),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 12),
|
||||
child: memeJour
|
||||
? Text(
|
||||
'Le ${_fmtLong(card.dateDebut)}',
|
||||
style: GoogleFonts.merienda(
|
||||
fontSize: 17,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: QuotidienTheme.ink,
|
||||
height: 1.35,
|
||||
),
|
||||
)
|
||||
: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Du ${_fmtLong(card.dateDebut)}',
|
||||
style: GoogleFonts.merienda(
|
||||
fontSize: 17,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: QuotidienTheme.ink,
|
||||
height: 1.35,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'Au ${_fmtLong(card.dateFin)}',
|
||||
style: GoogleFonts.merienda(
|
||||
fontSize: 17,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: QuotidienTheme.ink,
|
||||
height: 1.35,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
if (card.iconAsset != null) ...[
|
||||
const SizedBox(width: 8),
|
||||
const SizedBox(width: 10),
|
||||
Image.asset(
|
||||
card.iconAsset!,
|
||||
width: 80,
|
||||
@@ -410,45 +734,6 @@ class _BulleTile extends StatelessWidget {
|
||||
],
|
||||
],
|
||||
),
|
||||
if (card.dateDebut != null || card.dateFin != null) ...[
|
||||
const SizedBox(height: 10),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 12),
|
||||
child: memeJour
|
||||
? Text(
|
||||
'Le ${_fmtLong(card.dateDebut)}',
|
||||
style: GoogleFonts.merienda(
|
||||
fontSize: 17,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: QuotidienTheme.ink,
|
||||
height: 1.35,
|
||||
),
|
||||
)
|
||||
: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Du ${_fmtLong(card.dateDebut)}',
|
||||
style: GoogleFonts.merienda(
|
||||
fontSize: 17,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: QuotidienTheme.ink,
|
||||
height: 1.35,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'Au ${_fmtLong(card.dateFin)}',
|
||||
style: GoogleFonts.merienda(
|
||||
fontSize: 17,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: QuotidienTheme.ink,
|
||||
height: 1.35,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
if (card.statut == CarteStatut.refusee) ...[
|
||||
const SizedBox(height: 6),
|
||||
Text(
|
||||
@@ -522,7 +807,37 @@ class _BulleTile extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
/// Bouton pilule dessiné pleine largeur (fond pastel + coche / croix).
|
||||
/// Bouton pilule peinte (coche / croix intégrées) — carte congés.
|
||||
class _PilulePeinteButton extends StatelessWidget {
|
||||
final String asset;
|
||||
final String tooltip;
|
||||
final VoidCallback onTap;
|
||||
|
||||
const _PilulePeinteButton({
|
||||
required this.asset,
|
||||
required this.tooltip,
|
||||
required this.onTap,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Tooltip(
|
||||
message: tooltip,
|
||||
child: InkWell(
|
||||
onTap: onTap,
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
child: Image.asset(
|
||||
asset,
|
||||
height: 36,
|
||||
fit: BoxFit.contain,
|
||||
filterQuality: FilterQuality.high,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// Bouton pilule dessiné (fond pastel + coche / croix).
|
||||
class _ActionPill extends StatelessWidget {
|
||||
final String asset;
|
||||
final String iconAsset;
|
||||
|
||||