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