release: Agenda B0 (#214) → master #230
@@ -38,39 +38,61 @@ class QuotidienBandeau extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// 3 zones : gauche (logo + couple vers le centre) · pastilles · menu.
|
||||
// Les Expanded gauche/droite équilibrent le centrage des pastilles.
|
||||
return Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 12, 16, 8),
|
||||
child: Row(
|
||||
children: [
|
||||
Image.asset(
|
||||
QuotidienTheme.logoAsset,
|
||||
height: 44,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
if (contextSelector != null) ...[
|
||||
const SizedBox(width: 12),
|
||||
ConstrainedBox(
|
||||
constraints: const BoxConstraints(
|
||||
maxWidth: contextSelectorMaxWidth,
|
||||
),
|
||||
child: contextSelector!,
|
||||
Expanded(
|
||||
child: Row(
|
||||
children: [
|
||||
Image.asset(
|
||||
QuotidienTheme.logoAsset,
|
||||
height: 44,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
if (contextSelector != null) ...[
|
||||
const SizedBox(width: 16),
|
||||
Flexible(
|
||||
child: Align(
|
||||
// Pousse le couple vers le centre du bandeau.
|
||||
alignment: Alignment.centerRight,
|
||||
child: ConstrainedBox(
|
||||
constraints: const BoxConstraints(
|
||||
maxWidth: contextSelectorMaxWidth,
|
||||
),
|
||||
child: contextSelector!,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
],
|
||||
const Spacer(),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Flexible(
|
||||
child: _NavPills(
|
||||
selected: selectedSection,
|
||||
onSelected: onSectionSelected,
|
||||
flex: 2,
|
||||
child: Center(
|
||||
child: _NavPills(
|
||||
selected: selectedSection,
|
||||
onSelected: onSectionSelected,
|
||||
),
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
_UserMenu(
|
||||
displayName: userDisplayName,
|
||||
email: userEmail,
|
||||
onProfileTap: onProfileTap,
|
||||
onSearchAmTap: onSearchAmTap,
|
||||
onSettingsTap: onSettingsTap,
|
||||
onLogout: onLogout,
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Align(
|
||||
alignment: Alignment.centerRight,
|
||||
child: _UserMenu(
|
||||
displayName: userDisplayName,
|
||||
email: userEmail,
|
||||
onProfileTap: onProfileTap,
|
||||
onSearchAmTap: onSearchAmTap,
|
||||
onSettingsTap: onSettingsTap,
|
||||
onLogout: onLogout,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -87,51 +109,78 @@ class _NavPills extends StatelessWidget {
|
||||
required this.onSelected,
|
||||
});
|
||||
|
||||
static const double _pillHeight = 46;
|
||||
static const double _gap = 10;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
_pill(
|
||||
label: 'Cahier de liaison',
|
||||
section: QuotidienNavSection.liaison,
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
_pill(
|
||||
label: 'Agenda',
|
||||
section: QuotidienNavSection.agenda,
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
_pill(
|
||||
label: 'Contrat',
|
||||
section: QuotidienNavSection.contrat,
|
||||
),
|
||||
],
|
||||
return LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final naturalW = _pillHeight * QuotidienTheme.pillAspectRatio;
|
||||
final naturalTotal = 3 * naturalW + 2 * _gap;
|
||||
final maxW = constraints.maxWidth;
|
||||
// Réduit proportionnellement si la fenêtre est trop étroite
|
||||
// (évite l’overflow jaune/noir sur les pastilles).
|
||||
final scale = maxW.isFinite && maxW > 0 && maxW < naturalTotal
|
||||
? (maxW / naturalTotal).clamp(0.55, 1.0)
|
||||
: 1.0;
|
||||
final h = _pillHeight * scale;
|
||||
final w = naturalW * scale;
|
||||
final g = _gap * scale;
|
||||
final fontSize = (14 * scale).clamp(10.0, 14.0);
|
||||
|
||||
return Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
_pill(
|
||||
label: 'Cahier de liaison',
|
||||
section: QuotidienNavSection.liaison,
|
||||
width: w,
|
||||
height: h,
|
||||
fontSize: fontSize,
|
||||
),
|
||||
SizedBox(width: g),
|
||||
_pill(
|
||||
label: 'Agenda',
|
||||
section: QuotidienNavSection.agenda,
|
||||
width: w,
|
||||
height: h,
|
||||
fontSize: fontSize,
|
||||
),
|
||||
SizedBox(width: g),
|
||||
_pill(
|
||||
label: 'Contrat',
|
||||
section: QuotidienNavSection.contrat,
|
||||
width: w,
|
||||
height: h,
|
||||
fontSize: fontSize,
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Widget _pill({
|
||||
required String label,
|
||||
required QuotidienNavSection section,
|
||||
required double width,
|
||||
required double height,
|
||||
required double fontSize,
|
||||
}) {
|
||||
final active = selected == section;
|
||||
// Même famille que l’inscription : fonds « dessinés » (pas Material).
|
||||
// Les deux pastilles ont la même silhouette (ratio ~4:1) : la largeur
|
||||
// est dérivée de la hauteur pour ne jamais déformer le PNG.
|
||||
// Chaque section garde sa couleur ; l'inactive est juste plus claire.
|
||||
return ImageButton(
|
||||
bg: QuotidienTheme.pillAssetFor(section),
|
||||
bgOpacity: active ? 1.0 : QuotidienTheme.pillInactiveOpacity,
|
||||
width: _pillHeight * QuotidienTheme.pillAspectRatio,
|
||||
height: _pillHeight,
|
||||
width: width,
|
||||
height: height,
|
||||
text: label,
|
||||
textColor: QuotidienTheme.ink,
|
||||
fontSize: 14,
|
||||
fontSize: fontSize,
|
||||
onPressed: () => onSelected(section),
|
||||
);
|
||||
}
|
||||
|
||||
static const double _pillHeight = 46;
|
||||
}
|
||||
|
||||
class _UserMenu extends StatelessWidget {
|
||||
|
||||
Reference in New Issue
Block a user