fix(widgets): Ajouter 2 toggles côte à côte comme l'ancien design

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é.
This commit is contained in:
MARTIN Julien 2026-01-28 16:52:04 +01:00
parent 36ef0f8d5c
commit e700e50924

View File

@ -182,29 +182,75 @@ class _PersonalInfoFormScreenState extends State<PersonalInfoFormScreen> {
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ 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) ...[ if (widget.showSecondPersonToggle) ...[
Row( Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Text( Expanded(
'Il y a un 2ème parent ?', flex: 12,
style: GoogleFonts.merienda(fontSize: 20, fontWeight: FontWeight.w600), child: Row(
), children: [
const SizedBox(width: 15), const Icon(Icons.person_add_alt_1, size: 20),
Switch( const SizedBox(width: 8),
value: _hasSecondPerson, Flexible(
onChanged: (value) { child: Text(
setState(() { 'Ajouter Parent 2 ?',
_hasSecondPerson = value; style: GoogleFonts.merienda(fontWeight: FontWeight.bold),
_fieldsEnabled = value; overflow: TextOverflow.ellipsis,
}); ),
}, ),
activeColor: Theme.of(context).primaryColor, 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( Row(
children: [ children: [
@ -272,24 +318,6 @@ class _PersonalInfoFormScreenState extends State<PersonalInfoFormScreen> {
], ],
), ),
const SizedBox(height: 32), 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( CustomAppTextField(
controller: _addressController, controller: _addressController,
labelText: 'Adresse (N° et Rue)', labelText: 'Adresse (N° et Rue)',