feat(#131): en-tête fiche parent avec nom et co-parent.
Affiche le prénom/nom du parent en titre et le co-parent en sous-titre ; note handoff back dans archive/temporaires. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -3,11 +3,13 @@ import 'package:p_tits_pas/models/user.dart';
|
||||
|
||||
class ParentModel {
|
||||
final AppUser user;
|
||||
final AppUser? coParent;
|
||||
final int childrenCount;
|
||||
final List<ParentChildSummary> children;
|
||||
|
||||
ParentModel({
|
||||
required this.user,
|
||||
this.coParent,
|
||||
this.childrenCount = 0,
|
||||
this.children = const [],
|
||||
});
|
||||
@@ -20,12 +22,19 @@ class ParentModel {
|
||||
}
|
||||
final user = AppUser.fromJson(userJson);
|
||||
|
||||
AppUser? coParent;
|
||||
final coParentRaw = root['co_parent'];
|
||||
if (coParentRaw is Map) {
|
||||
coParent = AppUser.fromJson(Map<String, dynamic>.from(coParentRaw));
|
||||
}
|
||||
|
||||
final children = _parseChildren(root);
|
||||
final links = root['parentChildren'] ?? root['parent_children'];
|
||||
final linkCount = links is List ? links.length : 0;
|
||||
|
||||
return ParentModel(
|
||||
user: user,
|
||||
coParent: coParent,
|
||||
childrenCount: children.isNotEmpty ? children.length : linkCount,
|
||||
children: children,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user