Copie du code de la maquette #2
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
enum CardColorVertical {
|
||||
red('assets/cards/card_red.png'),
|
||||
pink('assets/cards/card_pink.png'),
|
||||
peach('assets/cards/card_peach.png'),
|
||||
lime('assets/cards/card_lime.png'),
|
||||
lavender('assets/cards/card_lavender.png'),
|
||||
green('assets/cards/card_green.png'),
|
||||
blue('assets/cards/card_blue.png');
|
||||
|
||||
final String path;
|
||||
const CardColorVertical(this.path);
|
||||
}
|
||||
|
||||
enum CardColorHorizontal {
|
||||
red('assets/cards/card_red_h.png'),
|
||||
pink('assets/cards/card_pink_h.png'),
|
||||
peach('assets/cards/card_peach_h.png'),
|
||||
lime('assets/cards/card_lime_h.png'),
|
||||
lavender('assets/cards/card_lavender_h.png'),
|
||||
green('assets/cards/card_green_h.png'),
|
||||
blue('assets/cards/card_blue_h.png');
|
||||
|
||||
final String path;
|
||||
const CardColorHorizontal(this.path);
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
class AppUser {
|
||||
final String id;
|
||||
final String email;
|
||||
final String role;
|
||||
final DateTime createdAt;
|
||||
final DateTime updatedAt;
|
||||
|
||||
AppUser({
|
||||
required this.id,
|
||||
required this.email,
|
||||
required this.role,
|
||||
required this.createdAt,
|
||||
required this.updatedAt,
|
||||
});
|
||||
|
||||
factory AppUser.fromJson(Map<String, dynamic> json) {
|
||||
return AppUser(
|
||||
id: json['id'] as String,
|
||||
email: json['email'] as String,
|
||||
role: json['role'] as String,
|
||||
createdAt: DateTime.parse(json['createdAt'] as String),
|
||||
updatedAt: DateTime.parse(json['updatedAt'] as String),
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'id': id,
|
||||
'email': email,
|
||||
'role': role,
|
||||
'createdAt': createdAt.toIso8601String(),
|
||||
'updatedAt': updatedAt.toIso8601String(),
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
import 'dart:io'; // Pour File
|
||||
import '../models/card_assets.dart'; // Import de l'enum CardColorVertical
|
||||
|
||||
class ParentData {
|
||||
String firstName;
|
||||
String lastName;
|
||||
String address; // Rue et numéro
|
||||
String postalCode; // Ajout
|
||||
String city; // Ajout
|
||||
String phone;
|
||||
String email;
|
||||
String password; // Peut-être pas nécessaire pour le récap, mais pour la création initiale si
|
||||
File? profilePicture; // Chemin ou objet File
|
||||
|
||||
ParentData({
|
||||
this.firstName = '',
|
||||
this.lastName = '',
|
||||
this.address = '', // Rue
|
||||
this.postalCode = '', // Ajout
|
||||
this.city = '', // Ajout
|
||||
this.phone = '',
|
||||
this.email = '',
|
||||
this.password = '',
|
||||
this.profilePicture,
|
||||
});
|
||||
}
|
||||
|
||||
class ChildData {
|
||||
String firstName;
|
||||
String lastName;
|
||||
String dob; // Date de naissance ou prévisionnelle
|
||||
bool photoConsent;
|
||||
bool multipleBirth;
|
||||
bool isUnbornChild;
|
||||
File? imageFile;
|
||||
CardColorVertical cardColor; // Nouveau champ pour la couleur de la carte
|
||||
|
||||
ChildData({
|
||||
this.firstName = '',
|
||||
this.lastName = '',
|
||||
this.dob = '',
|
||||
this.photoConsent = false,
|
||||
this.multipleBirth = false,
|
||||
this.isUnbornChild = false,
|
||||
this.imageFile,
|
||||
required this.cardColor, // Rendre requis dans le constructeur
|
||||
});
|
||||
}
|
||||
|
||||
class UserRegistrationData {
|
||||
ParentData parent1;
|
||||
ParentData? parent2; // Optionnel
|
||||
List<ChildData> children;
|
||||
String motivationText;
|
||||
bool cguAccepted;
|
||||
|
||||
UserRegistrationData({
|
||||
ParentData? parent1Data,
|
||||
this.parent2,
|
||||
List<ChildData>? childrenData,
|
||||
this.motivationText = '',
|
||||
this.cguAccepted = false,
|
||||
}) : parent1 = parent1Data ?? ParentData(),
|
||||
children = childrenData ?? [];
|
||||
|
||||
// Méthode pour ajouter/mettre à jour le parent 1
|
||||
void updateParent1(ParentData data) {
|
||||
parent1 = data;
|
||||
}
|
||||
|
||||
// Méthode pour ajouter/mettre à jour le parent 2
|
||||
void updateParent2(ParentData? data) {
|
||||
parent2 = data;
|
||||
}
|
||||
|
||||
// Méthode pour ajouter un enfant
|
||||
void addChild(ChildData child) {
|
||||
children.add(child);
|
||||
}
|
||||
|
||||
// Méthode pour mettre à jour un enfant (si nécessaire plus tard)
|
||||
void updateChild(int index, ChildData child) {
|
||||
if (index >= 0 && index < children.length) {
|
||||
children[index] = child;
|
||||
}
|
||||
}
|
||||
|
||||
// Mettre à jour la motivation
|
||||
void updateMotivation(String text) {
|
||||
motivationText = text;
|
||||
}
|
||||
|
||||
// Accepter les CGU
|
||||
void acceptCGU() {
|
||||
cguAccepted = true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user