Refactorisation des écrans d'inscription pour utiliser les nouveaux widgets : Parent Step 1 (227 → 65 lignes, -71%) - Utilise personal_info_form_screen - Conserve préremplissage des données de test - Couleur : peach Parent Step 2 (273 → 90 lignes, -67%) - Utilise personal_info_form_screen - Toggle "Il y a un 2ème parent" - Checkbox "Même adresse que parent 1" - Couleur : blue Parent Step 4 (247 → 42 lignes, -83%) - Utilise presentation_form_screen - Formulaire de motivation - Couleur : green AM Step 1 (209 → 65 lignes, -69%) - Utilise personal_info_form_screen - Conserve préremplissage des données de test - Couleur : blue AM Step 3 (195 → 45 lignes, -77%) - Utilise presentation_form_screen - Formulaire de présentation - Couleur : peach Total : -709 lignes de code maintenable !
43 lines
1.4 KiB
Dart
43 lines
1.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:provider/provider.dart';
|
|
import 'package:go_router/go_router.dart';
|
|
|
|
import '../../models/user_registration_data.dart';
|
|
import '../../widgets/presentation_form_screen.dart';
|
|
import '../../models/card_assets.dart';
|
|
import '../../utils/data_generator.dart';
|
|
|
|
class ParentRegisterStep4Screen extends StatelessWidget {
|
|
const ParentRegisterStep4Screen({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final registrationData = Provider.of<UserRegistrationData>(context, listen: false);
|
|
|
|
// Générer un texte de test si vide
|
|
String initialText = registrationData.motivationText;
|
|
bool initialCgu = registrationData.cguAccepted;
|
|
|
|
if (initialText.isEmpty) {
|
|
initialText = DataGenerator.motivation();
|
|
initialCgu = true;
|
|
}
|
|
|
|
return PresentationFormScreen(
|
|
stepText: 'Étape 4/5',
|
|
title: 'Motivation de votre demande',
|
|
cardColor: CardColorHorizontal.green,
|
|
textFieldHint: 'Écrivez ici pour motiver votre demande...',
|
|
initialText: initialText,
|
|
initialCguAccepted: initialCgu,
|
|
previousRoute: '/parent-register-step3',
|
|
onSubmit: (text, cguAccepted) {
|
|
registrationData.updateMotivation(text);
|
|
registrationData.acceptCGU(cguAccepted);
|
|
// Les infos financières peuvent être gérées ailleurs si nécessaire
|
|
context.go('/parent-register-step5');
|
|
},
|
|
);
|
|
}
|
|
}
|