diff --git a/frontend/lib/screens/auth/parent_register_step3_screen.dart b/frontend/lib/screens/auth/parent_register_step3_screen.dart index ec73328..df6d8ed 100644 --- a/frontend/lib/screens/auth/parent_register_step3_screen.dart +++ b/frontend/lib/screens/auth/parent_register_step3_screen.dart @@ -281,10 +281,6 @@ class _ParentRegisterStep3ScreenState extends State { final c = registrationData.children[index]; registrationData.updateChild(index, c.copyWith(lastName: value)); }), - onGenreChanged: (value) { - final oldChild = registrationData.children[index]; - registrationData.updateChild(index, oldChild.copyWith(genre: value)); - }, onTogglePhotoConsent: (newValue) { final oldChild = registrationData.children[index]; registrationData.updateChild(index, oldChild.copyWith(photoConsent: newValue)); @@ -381,10 +377,6 @@ class _ParentRegisterStep3ScreenState extends State { final c = registrationData.children[index]; registrationData.updateChild(index, c.copyWith(lastName: value)); }), - onGenreChanged: (value) { - final oldChild = registrationData.children[index]; - registrationData.updateChild(index, oldChild.copyWith(genre: value)); - }, onTogglePhotoConsent: (newValue) { final oldChild = registrationData.children[index]; registrationData.updateChild(index, oldChild.copyWith(photoConsent: newValue)); diff --git a/frontend/lib/screens/auth/parent_register_step5_screen.dart b/frontend/lib/screens/auth/parent_register_step5_screen.dart index c3d859a..62dc5d3 100644 --- a/frontend/lib/screens/auth/parent_register_step5_screen.dart +++ b/frontend/lib/screens/auth/parent_register_step5_screen.dart @@ -251,7 +251,6 @@ class _ParentRegisterStep5ScreenState extends State { onDateSelect: () {}, onFirstNameChanged: (v) {}, onLastNameChanged: (v) {}, - onGenreChanged: (_) {}, onTogglePhotoConsent: (v) {}, onToggleMultipleBirth: (v) {}, onToggleIsUnborn: (v) {}, diff --git a/frontend/lib/utils/parent_registration_payload.dart b/frontend/lib/utils/parent_registration_payload.dart index 3035efb..39b6904 100644 --- a/frontend/lib/utils/parent_registration_payload.dart +++ b/frontend/lib/utils/parent_registration_payload.dart @@ -59,9 +59,7 @@ class ParentRegistrationPayload { for (var i = 0; i < d.children.length; i++) { final c = d.children[i]; final label = 'Enfant ${i + 1}'; - if (!apiGenres.contains(c.genre)) { - return '$label : sélectionnez le genre (garçon, fille ou autre).'; - } + // Pas de saisie genre sur la carte (widget revenu à b18d5c8) : valeur par défaut côté JSON. if (c.isUnbornChild) { final due = _ddMmYyyyToIso(c.dob); if (due == null) { @@ -135,7 +133,7 @@ class ParentRegistrationPayload { static Map _childToJson(ChildData c, int index, String parentNom) { final map = { - 'genre': c.genre, + 'genre': apiGenres.contains(c.genre) ? c.genre : 'Autre', 'grossesse_multiple': c.multipleBirth, }; diff --git a/frontend/lib/widgets/child_card_widget.dart b/frontend/lib/widgets/child_card_widget.dart index ec30507..18bdf72 100644 --- a/frontend/lib/widgets/child_card_widget.dart +++ b/frontend/lib/widgets/child_card_widget.dart @@ -19,8 +19,6 @@ class ChildCardWidget extends StatefulWidget { final VoidCallback onDateSelect; final ValueChanged onFirstNameChanged; final ValueChanged onLastNameChanged; - /// `H`, `F` ou `Autre` (GenreType API). - final ValueChanged onGenreChanged; final ValueChanged onTogglePhotoConsent; final ValueChanged onToggleMultipleBirth; final ValueChanged onToggleIsUnborn; @@ -37,7 +35,6 @@ class ChildCardWidget extends StatefulWidget { required this.onDateSelect, required this.onFirstNameChanged, required this.onLastNameChanged, - required this.onGenreChanged, required this.onTogglePhotoConsent, required this.onToggleMultipleBirth, required this.onToggleIsUnborn, @@ -192,9 +189,7 @@ class _ChildCardWidgetState extends State { controller: _lastNameController, hint: 'Nom de l\'enfant', ), - SizedBox(height: 5.0 * scaleFactor), - _buildGenreField(context, config, scaleFactor), - SizedBox(height: 5.0 * scaleFactor), + SizedBox(height: 8.0 * scaleFactor), _buildField( config: config, scaleFactor: scaleFactor, @@ -357,8 +352,6 @@ class _ChildCardWidgetState extends State { const SizedBox(height: 12), _buildReadonlyField('Nom :', _lastNameController.text), const SizedBox(height: 12), - _buildReadonlyField('Genre :', _genreDisplayLabel(widget.childData.genre)), - const SizedBox(height: 12), _buildReadonlyField( widget.childData.isUnbornChild ? 'Date prévisionnelle :' : 'Date de naissance :', _dobController.text @@ -474,8 +467,6 @@ class _ChildCardWidgetState extends State { const SizedBox(height: 8), _buildReadonlyField('Nom :', _lastNameController.text), const SizedBox(height: 8), - _buildReadonlyField('Genre :', _genreDisplayLabel(widget.childData.genre)), - const SizedBox(height: 8), _buildReadonlyField( widget.childData.isUnbornChild ? 'Date prévisionnelle :' : 'Date de naissance :', _dobController.text @@ -565,111 +556,6 @@ class _ChildCardWidgetState extends State { ); } - static String _genreDisplayLabel(String g) { - switch (g) { - case 'H': - return 'Garçon'; - case 'F': - return 'Fille'; - case 'Autre': - return 'Autre / ne souhaite pas préciser'; - default: - return ''; - } - } - - Widget _buildGenreField(BuildContext context, DisplayConfig config, double scaleFactor) { - if (config.isReadonly) { - return FormFieldWrapper( - config: config, - label: 'Genre', - value: _genreDisplayLabel(widget.childData.genre), - ); - } - final fs = config.isMobile ? 13.0 : 16.0 * scaleFactor.clamp(0.85, 1.15); - final padH = config.isMobile ? 10.0 : 14.0 * scaleFactor; - final padV = config.isMobile ? 6.0 : 8.0; - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - 'Genre *', - style: GoogleFonts.merienda( - fontSize: config.isMobile ? 12.0 : 18.0, - color: Colors.black87, - fontWeight: FontWeight.w500, - ), - ), - SizedBox(height: 6), - Wrap( - spacing: 8, - runSpacing: 8, - children: [ - _genreChip( - value: 'H', - caption: 'Garçon', - fontSize: fs, - padH: padH, - padV: padV, - ), - _genreChip( - value: 'F', - caption: 'Fille', - fontSize: fs, - padH: padH, - padV: padV, - ), - _genreChip( - value: 'Autre', - caption: 'Autre', - fontSize: fs, - padH: padH, - padV: padV, - ), - ], - ), - ], - ); - } - - Widget _genreChip({ - required String value, - required String caption, - required double fontSize, - required double padH, - required double padV, - }) { - final selected = widget.childData.genre == value; - const accent = Color(0xFF2D6A4F); - return Material( - color: Colors.transparent, - child: InkWell( - onTap: () => widget.onGenreChanged(value), - borderRadius: BorderRadius.circular(12), - child: AnimatedContainer( - duration: const Duration(milliseconds: 150), - padding: EdgeInsets.symmetric(horizontal: padH, vertical: padV), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - border: Border.all( - color: selected ? accent : Colors.black.withValues(alpha: 0.28), - width: selected ? 2 : 1, - ), - color: selected ? accent.withValues(alpha: 0.12) : Colors.white.withValues(alpha: 0.35), - ), - child: Text( - caption, - style: GoogleFonts.merienda( - fontSize: fontSize, - color: Colors.black87, - fontWeight: selected ? FontWeight.w700 : FontWeight.w500, - ), - ), - ), - ), - ); - } - Widget _buildField({ required DisplayConfig config, required double scaleFactor,