Modif user provider, ajout photo de profil

This commit is contained in:
2025-03-06 11:13:05 +01:00
parent e5f7d8d2fd
commit 611c95d73b
4 changed files with 27 additions and 35 deletions

View File

@ -5,38 +5,29 @@ class UserProvider extends ChangeNotifier {
String? _firstName;
String? _lastName;
String? _role;
// String? _profilePictureUrl;
String? _profilePictureUrl;
String? _email;
// String? _phoneNumber;
String? _phoneNumber;
String? get uid => _uid;
String? get firstName => _firstName;
String? get lastName => _lastName;
String? get role => _role;
// String? get profilePhotoUrl => _profilePictureUrl;
String? get profilePhotoUrl => _profilePictureUrl;
String? get email => _email;
// String? get phoneNumber => _phoneNumber;
String? get phoneNumber => _phoneNumber;
// void setUserData(Map<String, dynamic> userData, String uid) {
// _uid = uid;
// _firstName = userData['firstName'];
// _lastName = userData['lastName'];
// _role = userData['role'] ?? 'USER'; // Default role if not provided
// // _profilePictureUrl = userData['profilePhotoUrl'];
// _email = userData['email'];
// // _phoneNumber = userData['phoneNumber'];
// notifyListeners(); // Notify listeners that state has changed
// }
void setUserData(Map<String, dynamic> userData, String uid) {
_uid = uid;
_firstName = userData['firstName'];
_lastName = userData['lastName'];
_role = userData['role'] ?? 'USER'; // Default role if not provided
if (userData['profilePhotoUrl'] != "") {
_profilePictureUrl = userData['profilePhotoUrl'];
}
_email = userData['email'];
print("User data set: $_firstName $_lastName ($_email)");
notifyListeners();
_phoneNumber = userData['phoneNumber'];
notifyListeners(); // Notify listeners that state has changed
}
void clearUserData() {
@ -44,9 +35,9 @@ class UserProvider extends ChangeNotifier {
_firstName = null;
_lastName = null;
_role = null;
// _profilePictureUrl = null;
_profilePictureUrl = null;
_email = null;
// _phoneNumber = null;
_phoneNumber = null;
notifyListeners();
}
}