From e700e50924e735ab38b4693f3471ec191161e1e5 Mon Sep 17 00:00:00 2001 From: Julien Martin Date: Wed, 28 Jan 2026 16:52:04 +0100 Subject: [PATCH] =?UTF-8?q?fix(widgets):=20Ajouter=202=20toggles=20c=C3=B4?= =?UTF-8?q?te=20=C3=A0=20c=C3=B4te=20comme=20l'ancien=20design?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Structure correcte pour Parent Step 2 : - Toggle gauche : "Ajouter Parent 2 ?" avec icône person_add_alt_1 - Toggle droit : "Même Adresse ?" avec icône home_work_outlined - Les 2 toggles sont dans une Row (flex: 12 chacun) - Toggle "Même Adresse" grisé si Parent 2 désactivé - Suppression de l'ancienne checkbox en bas Conforme à l'ancien code testé et validé. --- .../widgets/personal_info_form_screen.dart | 98 ++++++++++++------- 1 file changed, 63 insertions(+), 35 deletions(-) diff --git a/frontend/lib/widgets/personal_info_form_screen.dart b/frontend/lib/widgets/personal_info_form_screen.dart index 4d56712..9881f57 100644 --- a/frontend/lib/widgets/personal_info_form_screen.dart +++ b/frontend/lib/widgets/personal_info_form_screen.dart @@ -182,29 +182,75 @@ class _PersonalInfoFormScreenState extends State { child: Column( mainAxisSize: MainAxisSize.min, children: [ - // Toggle "Il y a un 2ème parent" (uniquement pour Parent 2) + // Toggles "Ajouter Parent 2" et "Même Adresse" (uniquement pour Parent 2) if (widget.showSecondPersonToggle) ...[ Row( - mainAxisAlignment: MainAxisAlignment.center, children: [ - Text( - 'Il y a un 2ème parent ?', - style: GoogleFonts.merienda(fontSize: 20, fontWeight: FontWeight.w600), - ), - const SizedBox(width: 15), - Switch( - value: _hasSecondPerson, - onChanged: (value) { - setState(() { - _hasSecondPerson = value; - _fieldsEnabled = value; - }); - }, - activeColor: Theme.of(context).primaryColor, + Expanded( + flex: 12, + child: Row( + children: [ + const Icon(Icons.person_add_alt_1, size: 20), + const SizedBox(width: 8), + Flexible( + child: Text( + 'Ajouter Parent 2 ?', + style: GoogleFonts.merienda(fontWeight: FontWeight.bold), + overflow: TextOverflow.ellipsis, + ), + ), + const Spacer(), + Switch( + value: _hasSecondPerson, + onChanged: (value) { + setState(() { + _hasSecondPerson = value; + _fieldsEnabled = value; + }); + }, + activeColor: Theme.of(context).primaryColor, + ), + ], + ), ), + const Expanded(flex: 1, child: SizedBox()), + if (widget.showSameAddressCheckbox) + Expanded( + flex: 12, + child: Row( + children: [ + Icon( + Icons.home_work_outlined, + size: 20, + color: _fieldsEnabled ? null : Colors.grey, + ), + const SizedBox(width: 8), + Flexible( + child: Text( + 'Même Adresse ?', + style: GoogleFonts.merienda( + color: _fieldsEnabled ? null : Colors.grey, + ), + overflow: TextOverflow.ellipsis, + ), + ), + const Spacer(), + Switch( + value: _sameAddress, + onChanged: _fieldsEnabled ? (value) { + setState(() { + _sameAddress = value ?? false; + _updateAddressFields(); + }); + } : null, + activeColor: Theme.of(context).primaryColor, + ), + ], + ), + ), ], ), - const SizedBox(height: 25), + const SizedBox(height: 32), ], Row( children: [ @@ -272,24 +318,6 @@ class _PersonalInfoFormScreenState extends State { ], ), const SizedBox(height: 32), - - // Checkbox "Même adresse" (uniquement pour Parent 2) - if (widget.showSameAddressCheckbox) ...[ - AppCustomCheckbox( - label: 'Même adresse que le parent 1', - value: _sameAddress, - onChanged: (value) { - if (_fieldsEnabled) { - setState(() { - _sameAddress = value ?? false; - _updateAddressFields(); - }); - } - }, - ), - const SizedBox(height: 20), - ], - CustomAppTextField( controller: _addressController, labelText: 'Adresse (N° et Rue)',