feat(ui): Amélioration des cartes de récapitulatif parents et enfants\n\n- Labes plus grands et espacement augmenté pour les cartes parents\n- Labels plus grands pour les champs enfants\n- Titre enfant intégré et centré dans la carte\n- Image enfant sans cadre blanc, occupant toute la hauteur\n- Bouton de modification bien positionné\n- Affichage des consentements en lecture seule sous la fiche enfant
This commit is contained in:
parent
03712bd99b
commit
760f4feca3
@ -3,16 +3,16 @@ import 'package:google_fonts/google_fonts.dart';
|
||||
import '../../models/user_registration_data.dart'; // Utilisation du vrai modèle
|
||||
import '../../widgets/image_button.dart'; // Import du ImageButton
|
||||
import '../../models/card_assets.dart'; // Import des enums de cartes
|
||||
import 'package:flutter/foundation.dart' show kIsWeb;
|
||||
|
||||
// Nouvelle méthode helper pour afficher un champ de type "lecture seule" stylisé
|
||||
Widget _buildDisplayFieldValue(BuildContext context, String label, String value, {bool multiLine = false, double fieldHeight = 50.0}) {
|
||||
const double detailFontSize = 18.0;
|
||||
Widget _buildDisplayFieldValue(BuildContext context, String label, String value, {bool multiLine = false, double fieldHeight = 50.0, double labelFontSize = 18.0}) {
|
||||
const FontWeight labelFontWeight = FontWeight.w600;
|
||||
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(label, style: GoogleFonts.merienda(fontSize: detailFontSize, fontWeight: labelFontWeight)),
|
||||
Text(label, style: GoogleFonts.merienda(fontSize: labelFontSize, fontWeight: labelFontWeight)),
|
||||
const SizedBox(height: 4),
|
||||
Container(
|
||||
width: double.infinity, // Prendra la largeur allouée par son parent (Expanded)
|
||||
@ -30,7 +30,7 @@ Widget _buildDisplayFieldValue(BuildContext context, String label, String value,
|
||||
),
|
||||
child: Text(
|
||||
value.isNotEmpty ? value : '-',
|
||||
style: GoogleFonts.merienda(fontSize: detailFontSize),
|
||||
style: GoogleFonts.merienda(fontSize: labelFontSize),
|
||||
maxLines: multiLine ? null : 1, // Permet plusieurs lignes si multiLine est true
|
||||
overflow: multiLine ? TextOverflow.visible : TextOverflow.ellipsis,
|
||||
),
|
||||
@ -46,28 +46,29 @@ class ParentRegisterStep5Screen extends StatelessWidget {
|
||||
|
||||
// Méthode pour construire la carte Parent 1
|
||||
Widget _buildParent1Card(BuildContext context, ParentData data) {
|
||||
const double verticalSpacing = 15.0; // Espacement vertical entre les "champs"
|
||||
const double verticalSpacing = 28.0; // Espacement vertical augmenté
|
||||
const double labelFontSize = 22.0; // Taille de label augmentée
|
||||
|
||||
List<Widget> details = [
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(child: _buildDisplayFieldValue(context, "Nom:", data.lastName)),
|
||||
const SizedBox(width: 20), // Espace entre les champs dans la Row
|
||||
Expanded(child: _buildDisplayFieldValue(context, "Prénom:", data.firstName)),
|
||||
Expanded(child: _buildDisplayFieldValue(context, "Nom:", data.lastName, labelFontSize: labelFontSize)),
|
||||
const SizedBox(width: 20),
|
||||
Expanded(child: _buildDisplayFieldValue(context, "Prénom:", data.firstName, labelFontSize: labelFontSize)),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: verticalSpacing),
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(child: _buildDisplayFieldValue(context, "Téléphone:", data.phone)),
|
||||
Expanded(child: _buildDisplayFieldValue(context, "Téléphone:", data.phone, labelFontSize: labelFontSize)),
|
||||
const SizedBox(width: 20),
|
||||
Expanded(child: _buildDisplayFieldValue(context, "Email:", data.email, multiLine: true)), // Email peut nécessiter plusieurs lignes
|
||||
Expanded(child: _buildDisplayFieldValue(context, "Email:", data.email, multiLine: true, labelFontSize: labelFontSize)),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: verticalSpacing),
|
||||
_buildDisplayFieldValue(context, "Adresse:", "${data.address}\n${data.postalCode} ${data.city}".trim(), multiLine: true, fieldHeight: 80), // fieldHeight est une suggestion pour 2 lignes
|
||||
_buildDisplayFieldValue(context, "Adresse:", "${data.address}\n${data.postalCode} ${data.city}".trim(), multiLine: true, fieldHeight: 80, labelFontSize: labelFontSize),
|
||||
];
|
||||
return _SummaryCard(
|
||||
backgroundImagePath: CardColorHorizontal.peach.path,
|
||||
@ -79,28 +80,28 @@ class ParentRegisterStep5Screen extends StatelessWidget {
|
||||
|
||||
// Méthode pour construire la carte Parent 2
|
||||
Widget _buildParent2Card(BuildContext context, ParentData data) {
|
||||
const double verticalSpacing = 15.0;
|
||||
// Structure similaire à _buildParent1Card
|
||||
const double verticalSpacing = 28.0;
|
||||
const double labelFontSize = 22.0;
|
||||
List<Widget> details = [
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(child: _buildDisplayFieldValue(context, "Nom:", data.lastName)),
|
||||
Expanded(child: _buildDisplayFieldValue(context, "Nom:", data.lastName, labelFontSize: labelFontSize)),
|
||||
const SizedBox(width: 20),
|
||||
Expanded(child: _buildDisplayFieldValue(context, "Prénom:", data.firstName)),
|
||||
Expanded(child: _buildDisplayFieldValue(context, "Prénom:", data.firstName, labelFontSize: labelFontSize)),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: verticalSpacing),
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(child: _buildDisplayFieldValue(context, "Téléphone:", data.phone)),
|
||||
Expanded(child: _buildDisplayFieldValue(context, "Téléphone:", data.phone, labelFontSize: labelFontSize)),
|
||||
const SizedBox(width: 20),
|
||||
Expanded(child: _buildDisplayFieldValue(context, "Email:", data.email, multiLine: true)),
|
||||
Expanded(child: _buildDisplayFieldValue(context, "Email:", data.email, multiLine: true, labelFontSize: labelFontSize)),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: verticalSpacing),
|
||||
_buildDisplayFieldValue(context, "Adresse:", "${data.address}\n${data.postalCode} ${data.city}".trim(), multiLine: true, fieldHeight: 80),
|
||||
_buildDisplayFieldValue(context, "Adresse:", "${data.address}\n${data.postalCode} ${data.city}".trim(), multiLine: true, fieldHeight: 80, labelFontSize: labelFontSize),
|
||||
];
|
||||
return _SummaryCard(
|
||||
backgroundImagePath: CardColorHorizontal.blue.path,
|
||||
@ -116,27 +117,125 @@ class ParentRegisterStep5Screen extends StatelessWidget {
|
||||
int index = entry.key;
|
||||
ChildData child = entry.value;
|
||||
|
||||
// Convertir CardColorVertical en CardColorHorizontal pour le récapitulatif
|
||||
// Ceci suppose que les noms de couleurs correspondent entre les deux enums.
|
||||
CardColorHorizontal cardColorHorizontal = CardColorHorizontal.values.firstWhere(
|
||||
(e) => e.name == child.cardColor.name,
|
||||
orElse: () => CardColorHorizontal.lavender, // Couleur par défaut si non trouvée
|
||||
orElse: () => CardColorHorizontal.lavender,
|
||||
);
|
||||
|
||||
List<Widget> details = [
|
||||
_buildDetailRow('Prénom', child.firstName),
|
||||
_buildDetailRow('Nom', child.lastName),
|
||||
_buildDetailRow(child.isUnbornChild ? 'Date Prév.' : 'Naissance', child.dob),
|
||||
_buildDetailRow('Cons. Photo', child.photoConsent ? 'Oui' : 'Non'),
|
||||
_buildDetailRow('Naiss. Mult.', child.multipleBirth ? 'Oui' : 'Non'),
|
||||
];
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: 20.0), // Espace entre les cartes enfants
|
||||
child: _SummaryCard(
|
||||
backgroundImagePath: cardColorHorizontal.path, // Utiliser la couleur convertie
|
||||
title: 'Enfant ${index + 1}' + (child.isUnbornChild ? ' (à naître)' : ''),
|
||||
content: details,
|
||||
onEdit: () { /* TODO: Naviguer vers step3 et focus l'enfant index */ },
|
||||
padding: const EdgeInsets.only(bottom: 20.0),
|
||||
child: Stack(
|
||||
children: [
|
||||
AspectRatio(
|
||||
aspectRatio: 2.0,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: 20.0, horizontal: 25.0),
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage(cardColorHorizontal.path),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
// Titre centré dans la carte
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
'Enfant ${index + 1}' + (child.isUnbornChild ? ' (à naître)' : ''),
|
||||
style: GoogleFonts.merienda(fontSize: 28, fontWeight: FontWeight.w600),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.edit, color: Colors.black54, size: 28),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pushNamed(
|
||||
'/parent-register/step3',
|
||||
arguments: {
|
||||
'registrationData': registrationData,
|
||||
'childIndex': index,
|
||||
},
|
||||
);
|
||||
},
|
||||
tooltip: 'Modifier',
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 18),
|
||||
Expanded(
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
// IMAGE SANS CADRE BLANC, PREND LA HAUTEUR
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Center(
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(18),
|
||||
child: AspectRatio(
|
||||
aspectRatio: 1,
|
||||
child: (child.imageFile != null)
|
||||
? (kIsWeb
|
||||
? Image.network(child.imageFile!.path, fit: BoxFit.cover)
|
||||
: Image.file(child.imageFile!, fit: BoxFit.cover))
|
||||
: Image.asset('assets/images/photo.png', fit: BoxFit.contain),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 32),
|
||||
// INFOS À DROITE (2/3)
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
_buildDisplayFieldValue(context, 'Prénom :', child.firstName, labelFontSize: 22.0),
|
||||
const SizedBox(height: 12),
|
||||
_buildDisplayFieldValue(context, 'Nom :', child.lastName, labelFontSize: 22.0),
|
||||
const SizedBox(height: 12),
|
||||
_buildDisplayFieldValue(context, child.isUnbornChild ? 'Date de naissance :' : 'Date de naissance :', child.dob, labelFontSize: 22.0),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 18),
|
||||
// Ligne des consentements
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Checkbox(
|
||||
value: child.photoConsent,
|
||||
onChanged: null,
|
||||
),
|
||||
Text('Consentement photo', style: GoogleFonts.merienda(fontSize: 16)),
|
||||
],
|
||||
),
|
||||
const SizedBox(width: 32),
|
||||
Row(
|
||||
children: [
|
||||
Checkbox(
|
||||
value: child.multipleBirth,
|
||||
onChanged: null,
|
||||
),
|
||||
Text('Naissance multiple', style: GoogleFonts.merienda(fontSize: 16)),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}).toList();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user