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:
2026-03-28 18:22:22 +01:00
parent 1e21fe25f3
commit a723412043
4 changed files with 3 additions and 128 deletions
+1 -115
View File
@@ -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,