diff --git a/frontend/assets/images/card_blue.png b/frontend/assets/images/card_blue.png deleted file mode 100644 index dac6ca2..0000000 Binary files a/frontend/assets/images/card_blue.png and /dev/null differ diff --git a/frontend/assets/images/card_lavander.png b/frontend/assets/images/card_lavander.png deleted file mode 100644 index 430790d..0000000 Binary files a/frontend/assets/images/card_lavander.png and /dev/null differ diff --git a/frontend/assets/images/card_lavander_h.png b/frontend/assets/images/card_lavander_h.png deleted file mode 100644 index 3675a75..0000000 Binary files a/frontend/assets/images/card_lavander_h.png and /dev/null differ diff --git a/frontend/assets/images/card_rose.png b/frontend/assets/images/card_rose.png deleted file mode 100644 index 69754d5..0000000 Binary files a/frontend/assets/images/card_rose.png and /dev/null differ diff --git a/frontend/assets/images/card_rose_h.png b/frontend/assets/images/card_rose_h.png deleted file mode 100644 index 7263feb..0000000 Binary files a/frontend/assets/images/card_rose_h.png and /dev/null differ diff --git a/frontend/assets/images/card_yellow.png b/frontend/assets/images/card_yellow.png deleted file mode 100644 index f84fec3..0000000 Binary files a/frontend/assets/images/card_yellow.png and /dev/null differ diff --git a/frontend/assets/images/card_yellow_h.png b/frontend/assets/images/card_yellow_h.png deleted file mode 100644 index 442dd14..0000000 Binary files a/frontend/assets/images/card_yellow_h.png and /dev/null differ diff --git a/frontend/lib/screens/auth/parent_register_step4_screen.dart b/frontend/lib/screens/auth/parent_register_step4_screen.dart index fca0d10..62ae003 100644 --- a/frontend/lib/screens/auth/parent_register_step4_screen.dart +++ b/frontend/lib/screens/auth/parent_register_step4_screen.dart @@ -6,6 +6,7 @@ import 'package:p_tits_pas/widgets/app_custom_checkbox.dart'; // Import de la ch // import 'package:p_tits_pas/models/placeholder_registration_data.dart'; // Remplacé import '../../models/user_registration_data.dart'; // Import du vrai modèle import '../../utils/data_generator.dart'; // Import du générateur +import '../../models/card_assets.dart'; // Import des enums de cartes class ParentRegisterStep4Screen extends StatefulWidget { final UserRegistrationData registrationData; // Accepte les données @@ -100,11 +101,9 @@ Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lo @override Widget build(BuildContext context) { final screenSize = MediaQuery.of(context).size; - // Calculer la largeur disponible pour le contenu principal de la colonne - // La SingleChildScrollView a un padding horizontal de 50.0 de chaque côté. - final availableContentWidth = screenSize.width - (50.0 * 2); - // Définir la taille du champ de texte carré comme un pourcentage de cette largeur disponible - final textFieldSize = (availableContentWidth * 0.65) / 2; // Réduction de la taille par deux + final cardWidth = screenSize.width * 0.6; // Largeur de la carte (60% de l'écran) + final double imageAspectRatio = 2.0; // Ratio corrigé (1024/512 = 2.0) + final cardHeight = cardWidth / imageAspectRatio; return Scaffold( body: Stack( @@ -120,7 +119,7 @@ Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lo crossAxisAlignment: CrossAxisAlignment.center, children: [ Text( - 'Étape 4/5', // Supposant 5 étapes au total pour l'instant + 'Étape 4/5', style: GoogleFonts.merienda(fontSize: 16, color: Colors.black54), ), const SizedBox(height: 20), @@ -130,37 +129,53 @@ Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lo textAlign: TextAlign.center, ), const SizedBox(height: 30), - SizedBox( - width: textFieldSize, - height: textFieldSize, - child: CustomDecoratedTextField( - controller: _motivationController, - hintText: 'Écrivez ici pour motiver votre demande...', - fieldHeight: textFieldSize, - maxLines: 10, - expandDynamically: true, + Container( + width: cardWidth, + height: cardHeight, + decoration: BoxDecoration( + image: DecorationImage( + image: AssetImage(CardColorHorizontal.green.path), + fit: BoxFit.fill, + ), + ), + child: Padding( + padding: const EdgeInsets.all(40.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Expanded( + child: CustomDecoratedTextField( + controller: _motivationController, + hintText: 'Écrivez ici pour motiver votre demande...', + fieldHeight: cardHeight * 0.6, + maxLines: 10, + expandDynamically: true, + fontSize: 18.0, + ), + ), + const SizedBox(height: 20), + GestureDetector( + onTap: () { + if (!_cguAccepted) { + _showCGUModal(); + } + }, + child: AppCustomCheckbox( + label: 'J\'accepte les conditions générales d\'utilisation', + value: _cguAccepted, + onChanged: (newValue) { + if (!_cguAccepted) { + _showCGUModal(); + } else { + setState(() => _cguAccepted = false); + } + }, + ), + ), + ], + ), ), ), - const SizedBox(height: 30), - GestureDetector( - onTap: () { - if (!_cguAccepted) { - _showCGUModal(); - } - }, - child: AppCustomCheckbox( - label: 'J\'accepte les conditions générales d\'utilisation', - value: _cguAccepted, - onChanged: (newValue) { - if (!_cguAccepted) { - _showCGUModal(); - } else { - setState(() => _cguAccepted = false); - } - }, - ), - ), - const SizedBox(height: 40), ], ), ), diff --git a/frontend/lib/screens/auth/parent_register_step5_screen.dart b/frontend/lib/screens/auth/parent_register_step5_screen.dart index b4de1ad..24a914c 100644 --- a/frontend/lib/screens/auth/parent_register_step5_screen.dart +++ b/frontend/lib/screens/auth/parent_register_step5_screen.dart @@ -4,37 +4,61 @@ import '../../models/user_registration_data.dart'; // Utilisation du vrai modèl 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; +import '../../widgets/custom_decorated_text_field.dart'; // Import du CustomDecoratedTextField // 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, double labelFontSize = 18.0}) { const FontWeight labelFontWeight = FontWeight.w600; + // Ne pas afficher le label si labelFontSize est 0 ou si label est vide + bool showLabel = label.isNotEmpty && labelFontSize > 0; + return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - 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) - height: multiLine ? null : fieldHeight, // Hauteur flexible pour multiligne, sinon fixe - constraints: multiLine ? const BoxConstraints(minHeight: 50.0) : null, // Hauteur min pour multiligne - padding: const EdgeInsets.symmetric(horizontal: 18.0, vertical: 12.0), // Ajuster au besoin - decoration: BoxDecoration( - image: const DecorationImage( - image: AssetImage('assets/images/input_field_bg.png'), // Image de fond du champ - fit: BoxFit.fill, + if (showLabel) + Text(label, style: GoogleFonts.merienda(fontSize: labelFontSize, fontWeight: labelFontWeight)), + if (showLabel) + const SizedBox(height: 4), + // Utiliser Expanded si multiLine et pas de hauteur fixe, sinon Container + multiLine && fieldHeight == null + ? Expanded( + child: Container( + width: double.infinity, + padding: const EdgeInsets.symmetric(horizontal: 18.0, vertical: 12.0), + decoration: BoxDecoration( + image: const DecorationImage( + image: AssetImage('assets/images/input_field_bg.png'), + fit: BoxFit.fill, + ), + ), + child: SingleChildScrollView( // Pour le défilement si le texte dépasse + child: Text( + value.isNotEmpty ? value : '-', + style: GoogleFonts.merienda(fontSize: labelFontSize > 0 ? labelFontSize : 18.0), // Garder une taille de texte par défaut si label caché + maxLines: null, // Permettre un nombre illimité de lignes + ), + ), + ), + ) + : Container( + width: double.infinity, + height: multiLine ? null : fieldHeight, + constraints: multiLine ? BoxConstraints(minHeight: fieldHeight) : null, + padding: const EdgeInsets.symmetric(horizontal: 18.0, vertical: 12.0), + decoration: BoxDecoration( + image: const DecorationImage( + image: AssetImage('assets/images/input_field_bg.png'), + fit: BoxFit.fill, + ), + ), + child: Text( + value.isNotEmpty ? value : '-', + style: GoogleFonts.merienda(fontSize: labelFontSize > 0 ? labelFontSize : 18.0), + maxLines: multiLine ? null : 1, + overflow: multiLine ? TextOverflow.visible : TextOverflow.ellipsis, + ), ), - // Si votre image input_field_bg.png a des coins arrondis intrinsèques, ce borderRadius n'est pas nécessaire - // ou doit correspondre. Sinon, pour une image rectangulaire, vous pouvez l'ajouter. - // borderRadius: BorderRadius.circular(12), - ), - child: Text( - value.isNotEmpty ? value : '-', - style: GoogleFonts.merienda(fontSize: labelFontSize), - maxLines: multiLine ? null : 1, // Permet plusieurs lignes si multiLine est true - overflow: multiLine ? TextOverflow.visible : TextOverflow.ellipsis, - ), - ), ], ); } @@ -154,10 +178,7 @@ class ParentRegisterStep5Screen extends StatelessWidget { onPressed: () { Navigator.of(context).pushNamed( '/parent-register/step3', - arguments: { - 'registrationData': registrationData, - 'childIndex': index, - }, + arguments: registrationData, ); }, tooltip: 'Modifier', @@ -243,16 +264,22 @@ class ParentRegisterStep5Screen extends StatelessWidget { // Méthode pour construire la carte Motivation Widget _buildMotivationCard(BuildContext context, String motivation) { - List details = [ - Text(motivation.isNotEmpty ? motivation : 'Aucune motivation renseignée.', - style: GoogleFonts.merienda(fontSize: 18), - maxLines: 4, - overflow: TextOverflow.ellipsis) - ]; return _SummaryCard( - backgroundImagePath: CardColorHorizontal.pink.path, + backgroundImagePath: CardColorHorizontal.green.path, title: 'Votre Motivation', - content: details, + content: [ + Expanded( + child: CustomDecoratedTextField( + controller: TextEditingController(text: motivation), + hintText: 'Aucune motivation renseignée.', + fieldHeight: 200, + maxLines: 10, + expandDynamically: true, + readOnly: true, + fontSize: 18.0, + ), + ), + ], onEdit: () => Navigator.of(context).pushNamed('/parent-register/step4', arguments: registrationData), ); } @@ -395,7 +422,7 @@ class _SummaryCard extends StatelessWidget { @override Widget build(BuildContext context) { return AspectRatio( - aspectRatio: 2.0, // Le ratio largeur/hauteur de nos images de fond + aspectRatio: 2.0, child: Container( padding: const EdgeInsets.symmetric(vertical: 20.0, horizontal: 25.0), decoration: BoxDecoration( @@ -405,31 +432,30 @@ class _SummaryCard extends StatelessWidget { ), borderRadius: BorderRadius.circular(15), ), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, + child: Column( children: [ + Row( + children: [ + Expanded( + child: Text( + title, + style: GoogleFonts.merienda(fontSize: 28, fontWeight: FontWeight.w600), + textAlign: TextAlign.center, + ), + ), + IconButton( + icon: const Icon(Icons.edit, color: Colors.black54, size: 28), + onPressed: onEdit, + tooltip: 'Modifier', + ), + ], + ), + const SizedBox(height: 18), Expanded( child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, // Pour que la colonne prenne la hauteur du contenu - children: [ - Align( // Centrer le titre - alignment: Alignment.center, - child: Text( - title, - style: GoogleFonts.merienda(fontSize: 22, fontWeight: FontWeight.bold, color: Colors.black87), // Police légèrement augmentée - ), - ), - const SizedBox(height: 12), // Espacement ajusté après le titre - ...content, - ], + children: content, ), ), - IconButton( - icon: const Icon(Icons.edit, color: Colors.black54, size: 28), // Icône un peu plus grande - onPressed: onEdit, - tooltip: 'Modifier', - ), ], ), ), diff --git a/frontend/lib/widgets/custom_decorated_text_field.dart b/frontend/lib/widgets/custom_decorated_text_field.dart index 9f7f52c..c4a2d1f 100644 --- a/frontend/lib/widgets/custom_decorated_text_field.dart +++ b/frontend/lib/widgets/custom_decorated_text_field.dart @@ -7,6 +7,8 @@ class CustomDecoratedTextField extends StatelessWidget { final int maxLines; final double? fieldHeight; // Hauteur optionnelle pour le champ final bool expandDynamically; // Nouvelle propriété + final bool readOnly; + final double fontSize; const CustomDecoratedTextField({ super.key, @@ -15,6 +17,8 @@ class CustomDecoratedTextField extends StatelessWidget { this.maxLines = 10, // Un nombre raisonnable de lignes par défaut si non dynamique this.fieldHeight, // Si non fourni, la hauteur sera intrinsèque ou définie par l'image this.expandDynamically = false, // Par défaut, non dynamique + this.readOnly = false, + this.fontSize = 15.0, }); @override @@ -37,11 +41,12 @@ class CustomDecoratedTextField extends StatelessWidget { controller: controller, keyboardType: TextInputType.multiline, maxLines: expandDynamically ? null : maxLines, // S'étend dynamiquement si expandDynamically est true - style: GoogleFonts.merienda(fontSize: 15, color: Colors.black87), + style: GoogleFonts.merienda(fontSize: fontSize, color: Colors.black87), textAlignVertical: TextAlignVertical.top, + readOnly: readOnly, decoration: InputDecoration( hintText: hintText, - hintStyle: GoogleFonts.merienda(fontSize: 15, color: Colors.black54.withOpacity(0.7)), + hintStyle: GoogleFonts.merienda(fontSize: fontSize, color: Colors.black54.withOpacity(0.7)), border: InputBorder.none, // Pas de bordure pour le TextFormField lui-même contentPadding: EdgeInsets.zero, // Le padding est géré par le widget Padding externe // Pour aligner le hintText en haut à gauche