fix(#112): afficher photos enfants en reprise + consentement cohérent

Charge existingPhotoUrl dans les cartes enfant (étapes 3 et 5) et pré-coche
le consentement photo lorsqu'une photo est déjà en base.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-16 17:00:15 +02:00
co-authored by Cursor
parent f300505225
commit 9b7231f1da
5 changed files with 36 additions and 7 deletions
+17 -1
View File
@@ -1,4 +1,5 @@
import 'dart:math' as math;
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
@@ -20,7 +21,7 @@ bool _hasChildPhoto(ChildData c) {
return registrationPhotoSlotHasImage(
imageBytes: c.imageBytes,
imageFile: c.imageFile,
imagePathOrAsset: null,
imagePathOrAsset: c.existingPhotoUrl,
);
}
@@ -33,6 +34,20 @@ Widget _buildChildPhotoImage(ChildData c, {required BoxFit fit}) {
if (f != null) {
return kIsWeb ? Image.network(f.path, fit: fit) : Image.file(f, fit: fit);
}
final url = c.existingPhotoUrl?.trim();
if (url != null && url.isNotEmpty) {
if (url.startsWith('http://') || url.startsWith('https://')) {
return Image.network(url, fit: fit);
}
if (!kIsWeb) {
try {
final file = File(url);
if (file.existsSync()) {
return Image.file(file, fit: fit);
}
} catch (_) {}
}
}
return Image.asset('assets/images/photo.png', fit: BoxFit.contain);
}
@@ -221,6 +236,7 @@ class _ChildCardWidgetState extends State<ChildCardWidget> {
scaleFactor: scaleFactor,
imageBytes: widget.childData.imageBytes,
imageFile: widget.childData.imageFile,
imagePathOrAsset: widget.childData.existingPhotoUrl,
onTapPick: !config.isReadonly ? widget.onPickImage : null,
onClear: !config.isReadonly ? widget.onClearImage : null,
baseShadowColor: baseCardColorForShadow,
@@ -71,6 +71,9 @@ class RegistrationPhotoSlot extends StatelessWidget {
if (p.startsWith('assets/')) {
return Image.asset(p, fit: fit);
}
if (p.startsWith('http://') || p.startsWith('https://')) {
return Image.network(p, fit: fit);
}
if (!kIsWeb) {
try {
final file = File(p);