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,16 +182,24 @@ class _PersonalInfoFormScreenState extends State<PersonalInfoFormScreen> {
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),
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 SizedBox(width: 15),
),
const Spacer(),
Switch(
value: _hasSecondPerson,
onChanged: (value) {
@ -204,7 +212,45 @@ class _PersonalInfoFormScreenState extends State<PersonalInfoFormScreen> {
),
],
),
const SizedBox(height: 25),
),
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: 32),
],
Row(
children: [
@ -272,24 +318,6 @@ class _PersonalInfoFormScreenState extends State<PersonalInfoFormScreen> {
],
),
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)',