feat: Update registration data model for Childminder and adjust related screen AM logic

This commit is contained in:
Hanim
2025-08-14 11:33:40 +02:00
parent 14efccc711
commit acda4244a9
2 changed files with 110 additions and 8 deletions
@@ -1,6 +1,6 @@
import 'package:flutter/material.dart';
import 'package:p_tits_pas/models/am_user_registration_data.dart';
import 'package:p_tits_pas/models/card_assets.dart';
import 'package:p_tits_pas/models/parent_user_registration_data.dart';
import 'package:p_tits_pas/utils/data_generator.dart';
import 'package:p_tits_pas/widgets/FormFieldConfig.dart';
import 'package:google_fonts/google_fonts.dart';
@@ -15,7 +15,7 @@ class AmRegisterStep1Screen extends StatefulWidget {
class _AmRegisterStep1ScreenState extends State<AmRegisterStep1Screen> {
final _formKey = GlobalKey<FormState>();
late UserRegistrationData _registrationData;
late ChildminderRegistrationData _registrationData;
final _lastNameController = TextEditingController();
final _firstNameController = TextEditingController();
@@ -27,11 +27,15 @@ class _AmRegisterStep1ScreenState extends State<AmRegisterStep1Screen> {
final _postalCodeController = TextEditingController();
final _cityController = TextEditingController();
// File? _selectedImage;
// bool _photoConsent = false;
// final ImagePicker _picker = ImagePicker();
@override
void initState() {
super.initState();
_registrationData = UserRegistrationData();
_registrationData = ChildminderRegistrationData();
_generateAndFillData();
}
@@ -152,10 +156,10 @@ class _AmRegisterStep1ScreenState extends State<AmRegisterStep1Screen> {
],
];
void _handleSubmit() {
void _handleSubmit() {
if (_formKey.currentState?.validate() ?? false) {
_registrationData.updateParent1(
ParentData(
_registrationData.updateIdentity(
ChildminderId(
firstName: _firstNameController.text,
lastName: _lastNameController.text,
address: _addressController.text,
@@ -166,10 +170,12 @@ class _AmRegisterStep1ScreenState extends State<AmRegisterStep1Screen> {
password: _passwordController.text,
),
);
Navigator.pushNamed(context, '/am-register/step2', arguments: _registrationData);
Navigator.pushNamed(context, '/am-register/step2',
arguments: _registrationData);
}
}
@override
Widget build(BuildContext context) {
final screenSize = MediaQuery.of(context).size;
@@ -189,7 +195,7 @@ class _AmRegisterStep1ScreenState extends State<AmRegisterStep1Screen> {
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'Étape 1/5',
'Étape 1/4',
style: GoogleFonts.merienda(fontSize: 16, color: Colors.black54),
),
const SizedBox(height: 10),