fix(ui): prevent dropdown menu from overlapping main button in CoupleSelectorBandeau

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-24 00:33:02 +02:00
co-authored by Cursor
parent df4f48e864
commit 5eb3468fe0
@@ -68,39 +68,46 @@ class CoupleSelectorBandeau extends StatelessWidget {
if (!multi) return card; if (!multi) return card;
return PopupMenuButton<String>( return Theme(
tooltip: 'Changer de garde', data: Theme.of(context).copyWith(
offset: const Offset(0, 4), // Rapproché du bandeau principal hoverColor: Colors.transparent,
color: Colors.transparent, // Le fond devient invisible splashColor: Colors.transparent,
elevation: 0, // Pas d'ombre carrée highlightColor: Colors.transparent,
constraints: BoxConstraints.tightFor(width: constraints.maxWidth), focusColor: Colors.transparent,
padding: EdgeInsets.zero, ),
onSelected: (id) { child: PopupMenuButton<String>(
final chosen = couples.firstWhere((c) => c.id == id); tooltip: 'Changer de garde',
onCoupleSelected?.call(chosen); // L'offset doit être suffisant pour descendre sous la carte (qui fait 90px).
}, offset: const Offset(0, 95),
itemBuilder: (context) => [ color: Colors.transparent, // Le fond devient invisible
for (final c in couples) elevation: 0, // Pas d'ombre carrée
// On ne réaffiche pas le couple actuellement sélectionné dans le menu déroulant constraints: BoxConstraints.tightFor(width: constraints.maxWidth),
// puisqu'il est déjà visible en tant que "bouton" principal. padding: EdgeInsets.zero,
if (c.id != selected.id) onSelected: (id) {
PopupMenuItem<String>( final chosen = couples.firstWhere((c) => c.id == id);
value: c.id, onCoupleSelected?.call(chosen);
padding: EdgeInsets.zero, },
// Marge verticale pour que les pastilles ne soient pas collées itemBuilder: (context) => [
child: Padding( for (final c in couples)
padding: const EdgeInsets.only(bottom: 8), if (c.id != selected.id)
child: _CoupleCard( PopupMenuItem<String>(
mode: mode, value: c.id,
couple: c, padding: EdgeInsets.zero,
showChevron: false, height: 100, // Hauteur de la carte (90) + un peu de marge (10)
selected: false, child: Padding(
isMenuItem: true, padding: const EdgeInsets.only(bottom: 10),
child: _CoupleCard(
mode: mode,
couple: c,
showChevron: false,
selected: false,
isMenuItem: true,
),
), ),
), ),
), ],
], child: card,
child: card, ),
); );
}); });
} }