revert(ui): ChildCardWidget identique au commit b18d5c8 (7 fév. 2026)
- Restauration fichier tel que dans feat(frontend): Refonte multi-modes (#78) - Retrait onGenreChanged (step3/step5) ; genre API: défaut Autre si non renseigné jusqu’à nouvelle UI genre Made-with: Cursor
This commit is contained in:
parent
1e21fe25f3
commit
a723412043
@ -281,10 +281,6 @@ class _ParentRegisterStep3ScreenState extends State<ParentRegisterStep3Screen> {
|
||||
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<ParentRegisterStep3Screen> {
|
||||
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));
|
||||
|
||||
@ -251,7 +251,6 @@ class _ParentRegisterStep5ScreenState extends State<ParentRegisterStep5Screen> {
|
||||
onDateSelect: () {},
|
||||
onFirstNameChanged: (v) {},
|
||||
onLastNameChanged: (v) {},
|
||||
onGenreChanged: (_) {},
|
||||
onTogglePhotoConsent: (v) {},
|
||||
onToggleMultipleBirth: (v) {},
|
||||
onToggleIsUnborn: (v) {},
|
||||
|
||||
@ -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<String, dynamic> _childToJson(ChildData c, int index, String parentNom) {
|
||||
final map = <String, dynamic>{
|
||||
'genre': c.genre,
|
||||
'genre': apiGenres.contains(c.genre) ? c.genre : 'Autre',
|
||||
'grossesse_multiple': c.multipleBirth,
|
||||
};
|
||||
|
||||
|
||||
@ -19,8 +19,6 @@ class ChildCardWidget extends StatefulWidget {
|
||||
final VoidCallback onDateSelect;
|
||||
final ValueChanged<String> onFirstNameChanged;
|
||||
final ValueChanged<String> onLastNameChanged;
|
||||
/// `H`, `F` ou `Autre` (GenreType API).
|
||||
final ValueChanged<String> onGenreChanged;
|
||||
final ValueChanged<bool> onTogglePhotoConsent;
|
||||
final ValueChanged<bool> onToggleMultipleBirth;
|
||||
final ValueChanged<bool> 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<ChildCardWidget> {
|
||||
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<ChildCardWidget> {
|
||||
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<ChildCardWidget> {
|
||||
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<ChildCardWidget> {
|
||||
);
|
||||
}
|
||||
|
||||
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,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user