Étapes 1 à 3 du formulaire d'inscription AM : données du jeu de test officiel (03_seed_test_data.sql) au lieu du générateur aléatoire. Made-with: Cursor
62 lines
1.9 KiB
Dart
62 lines
1.9 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:provider/provider.dart';
|
|
import 'package:go_router/go_router.dart';
|
|
|
|
import '../../models/am_registration_data.dart';
|
|
import '../../widgets/personal_info_form_screen.dart';
|
|
import '../../models/card_assets.dart';
|
|
|
|
class AmRegisterStep1Screen extends StatelessWidget {
|
|
const AmRegisterStep1Screen({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final registrationData = Provider.of<AmRegistrationData>(context, listen: false);
|
|
|
|
// Données de test : Marie DUBOIS (jeu de test 03_seed_test_data.sql / docs/test-data)
|
|
PersonalInfoData initialData;
|
|
if (registrationData.firstName.isEmpty) {
|
|
initialData = PersonalInfoData(
|
|
firstName: 'Marie',
|
|
lastName: 'DUBOIS',
|
|
phone: '0696345678',
|
|
email: 'marie.dubois@ptits-pas.fr',
|
|
address: '25 Rue de la République',
|
|
postalCode: '95870',
|
|
city: 'Bezons',
|
|
);
|
|
} else {
|
|
initialData = PersonalInfoData(
|
|
firstName: registrationData.firstName,
|
|
lastName: registrationData.lastName,
|
|
phone: registrationData.phone,
|
|
email: registrationData.email,
|
|
address: registrationData.streetAddress,
|
|
postalCode: registrationData.postalCode,
|
|
city: registrationData.city,
|
|
);
|
|
}
|
|
|
|
return PersonalInfoFormScreen(
|
|
stepText: 'Étape 1/4',
|
|
title: 'Vos informations personnelles',
|
|
cardColor: CardColorHorizontal.blue,
|
|
initialData: initialData,
|
|
previousRoute: '/register-choice',
|
|
onSubmit: (data, {hasSecondPerson, sameAddress}) {
|
|
registrationData.updateIdentityInfo(
|
|
firstName: data.firstName,
|
|
lastName: data.lastName,
|
|
phone: data.phone,
|
|
email: data.email,
|
|
streetAddress: data.address,
|
|
postalCode: data.postalCode,
|
|
city: data.city,
|
|
password: '',
|
|
);
|
|
context.go('/am-register-step2');
|
|
},
|
|
);
|
|
}
|
|
}
|