Implémentation du parcours d'inscription des assistantes maternelles en 4 étapes + écran de confirmation, en utilisant Provider pour la gestion d'état. Fonctionnalités implémentées : - Étape 1 : Identité (nom, prénom, adresse, email, mot de passe) - Étape 2 : Infos professionnelles (photo, agrément, NIR, capacité d'accueil) - Étape 3 : Présentation personnelle et acceptation CGU - Étape 4 : Récapitulatif et validation finale - Écran de confirmation post-inscription Fichiers ajoutés : - models/nanny_registration_data.dart : Modèle de données avec Provider - screens/auth/nanny_register_step1_screen.dart : Identité - screens/auth/nanny_register_step2_screen.dart : Infos pro - screens/auth/nanny_register_step3_screen.dart : Présentation - screens/auth/nanny_register_step4_screen.dart : Récapitulatif - screens/auth/nanny_register_confirmation_screen.dart : Confirmation - screens/unknown_screen.dart : Écran pour routes inconnues - config/app_router.dart : Copie du routeur (à intégrer) Refs: #40 (Panneau 1 Identité), #41 (Panneau 2 Infos pro), #42 (Finalisation)
145 lines
6.0 KiB
Dart
145 lines
6.0 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:provider/provider.dart';
|
|
import 'package:go_router/go_router.dart';
|
|
import 'package:google_fonts/google_fonts.dart';
|
|
import 'dart:math' as math;
|
|
|
|
import '../../../models/nanny_registration_data.dart';
|
|
import '../../../widgets/custom_decorated_text_field.dart';
|
|
import '../../../models/card_assets.dart';
|
|
|
|
class NannyRegisterStep3Screen extends StatefulWidget {
|
|
const NannyRegisterStep3Screen({super.key});
|
|
|
|
@override
|
|
State<NannyRegisterStep3Screen> createState() => _NannyRegisterStep3ScreenState();
|
|
}
|
|
|
|
class _NannyRegisterStep3ScreenState extends State<NannyRegisterStep3Screen> {
|
|
final _formKey = GlobalKey<FormState>();
|
|
final _presentationController = TextEditingController();
|
|
bool _cguAccepted = false;
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
final data = Provider.of<NannyRegistrationData>(context, listen: false);
|
|
_presentationController.text = 'Disponible immédiatement, expérience avec les tout-petits.';
|
|
_cguAccepted = true;
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
_presentationController.dispose();
|
|
super.dispose();
|
|
}
|
|
|
|
void _submitForm() {
|
|
final nannyData = Provider.of<NannyRegistrationData>(context, listen: false);
|
|
nannyData.updatePresentationAndCgu(presentationText: _presentationController.text);
|
|
// Validation CGU désactivée temporairement
|
|
nannyData.updatePresentationAndCgu(cguAccepted: _cguAccepted);
|
|
context.go('/nanny-register-step4');
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final nannyData = Provider.of<NannyRegistrationData>(context, listen: false);
|
|
final screenSize = MediaQuery.of(context).size;
|
|
const cardColor = CardColorHorizontal.peach; // Couleur différente
|
|
|
|
return Scaffold(
|
|
body: Stack(
|
|
children: [
|
|
Positioned.fill(
|
|
child: Image.asset('assets/images/paper2.png', fit: BoxFit.cover, repeat: ImageRepeat.repeat),
|
|
),
|
|
Center(
|
|
child: SingleChildScrollView(
|
|
padding: const EdgeInsets.symmetric(vertical: 40.0),
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Text('Étape 3/4', style: GoogleFonts.merienda(fontSize: 16, color: Colors.black54)),
|
|
const SizedBox(height: 10),
|
|
Container(
|
|
width: screenSize.width * 0.7,
|
|
padding: const EdgeInsets.symmetric(vertical: 40, horizontal: 50),
|
|
constraints: const BoxConstraints(minHeight: 500), // Ajuster hauteur
|
|
decoration: BoxDecoration(
|
|
image: DecorationImage(image: AssetImage(cardColor.path), fit: BoxFit.fill),
|
|
),
|
|
child: Form( // Garder Form même si validation simple
|
|
key: _formKey,
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Text(
|
|
'Présentation et Conditions',
|
|
style: GoogleFonts.merienda(fontSize: 24, fontWeight: FontWeight.bold, color: Colors.black87),
|
|
textAlign: TextAlign.center,
|
|
),
|
|
const SizedBox(height: 30),
|
|
Text(
|
|
'Rédigez un court message à destination du gestionnaire (facultatif) :',
|
|
style: TextStyle(fontSize: 16, color: Colors.black87),
|
|
),
|
|
const SizedBox(height: 10),
|
|
CustomDecoratedTextField(
|
|
controller: _presentationController,
|
|
hintText: 'Ex: Disponible immédiatement, formation premiers secours...',
|
|
maxLines: 6,
|
|
// style: cardColor.textFieldStyle, // Utiliser style par défaut ou adapter
|
|
),
|
|
const SizedBox(height: 30),
|
|
CheckboxListTile(
|
|
title: const Text('J\'ai lu et j\'accepte les Conditions Générales d\'Utilisation et la Politique de confidentialité de P\'titsPas.', style: TextStyle(fontSize: 14)),
|
|
subtitle: Text('Vous devez accepter pour continuer.', style: TextStyle(color: Colors.black54.withOpacity(0.7))),
|
|
value: _cguAccepted,
|
|
onChanged: (bool? value) {
|
|
setState(() { _cguAccepted = value ?? false; });
|
|
},
|
|
controlAffinity: ListTileControlAffinity.leading,
|
|
dense: true,
|
|
activeColor: Theme.of(context).primaryColor,
|
|
),
|
|
// TODO: Ajouter lien vers CGU
|
|
],
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
// Chevron Gauche (Retour)
|
|
Positioned(
|
|
top: screenSize.height / 2 - 20,
|
|
left: 40,
|
|
child: IconButton(
|
|
icon: Transform(alignment: Alignment.center, transform: Matrix4.rotationY(math.pi), child: Image.asset('assets/images/chevron_right.png', height: 40)),
|
|
onPressed: () {
|
|
if (context.canPop()) {
|
|
context.pop();
|
|
} else {
|
|
context.go('/nanny-register-step2');
|
|
}
|
|
},
|
|
tooltip: 'Précédent',
|
|
),
|
|
),
|
|
// Chevron Droit (Suivant)
|
|
Positioned(
|
|
top: screenSize.height / 2 - 20,
|
|
right: 40,
|
|
child: IconButton(
|
|
icon: Image.asset('assets/images/chevron_right.png', height: 40),
|
|
onPressed: _submitForm,
|
|
tooltip: 'Suivant',
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
} |