feat(am): inscription photo (picker, bytes web, photo_filename) (#120)

- ProfessionalInfoFormScreen : ImagePicker par défaut, MemoryImage, consentement si photo réelle
- AmRegistrationData : photoBytes + photoFilename ; récap étape 4
- registerAM : base64 + filename, erreurs réseau/JSON comme parents
- docs: 23_LISTE-TICKETS — issue #120

Made-with: Cursor
This commit is contained in:
2026-04-13 13:19:31 +02:00
parent cdae9b5f7c
commit 01c1be8f16
6 changed files with 147 additions and 60 deletions
+16 -10
View File
@@ -14,7 +14,9 @@ class AmRegistrationData extends ChangeNotifier {
// bool photoConsent = false; // Déplacé ou géré à l'étape 2
// Step 2: Professional Info
String? photoPath; // Ajouté pour l'étape 2
String? photoPath; // Chemin fichier local (hors web) si pas doctets en mémoire
Uint8List? photoBytes; // Galerie / web (ImagePicker)
String? photoFilename; // Nom pour lAPI (ex. image.jpg)
bool photoConsent = false; // Ajouté pour l'étape 2
DateTime? dateOfBirth;
String birthCity = ''; // Nouveau
@@ -57,6 +59,8 @@ class AmRegistrationData extends ChangeNotifier {
void updateProfessionalInfo({
String? photoPath,
Uint8List? photoBytes,
String? photoFilename,
bool? photoConsent,
DateTime? dateOfBirth,
String? birthCity, // Nouveau
@@ -66,10 +70,9 @@ class AmRegistrationData extends ChangeNotifier {
String? agrementNumber,
int? capacity,
}) {
// Allow setting photoPath to null explicitly
if (photoPath != null || this.photoPath != null) {
this.photoPath = photoPath;
}
this.photoPath = photoPath;
this.photoBytes = photoBytes;
this.photoFilename = photoFilename;
this.photoConsent = photoConsent ?? this.photoConsent;
this.dateOfBirth = dateOfBirth ?? this.dateOfBirth;
this.birthCity = birthCity ?? this.birthCity; // Nouveau
@@ -101,12 +104,15 @@ class AmRegistrationData extends ChangeNotifier {
email.isNotEmpty;
// password n'est pas requis à l'inscription (défini après validation par lien email)
/// Photo réelle (pas seulement un placeholder asset).
bool get _hasUserPhoto =>
(photoBytes != null && photoBytes!.isNotEmpty) ||
(photoPath != null &&
photoPath!.isNotEmpty &&
!photoPath!.startsWith('assets/'));
bool get isStep2Complete =>
// photoConsent is mandatory if a photo is system-required, otherwise optional.
// For now, let's assume if photoPath is present, consent should ideally be true.
// Or, make consent always mandatory if photo section exists.
// Based on new mockup, photo is present, so consent might be implicitly or explicitly needed.
(photoPath != null ? photoConsent == true : true) && // Ajuster selon la logique de consentement désirée
(_hasUserPhoto ? photoConsent == true : true) &&
dateOfBirth != null &&
birthCity.isNotEmpty &&
birthCountry.isNotEmpty &&