Add profile picture support for group members and enhance trip details display
This commit is contained in:
@@ -875,7 +875,7 @@ class _CreateTripContentState extends State<CreateTripContent> {
|
||||
Future<void> _updateGroupMembers(
|
||||
String tripId,
|
||||
user_state.UserModel currentUser,
|
||||
List<Map<String, String>> participantsData,
|
||||
List<Map<String, dynamic>> participantsData,
|
||||
) async {
|
||||
final groupBloc = context.read<GroupBloc>();
|
||||
try {
|
||||
@@ -933,12 +933,14 @@ class _CreateTripContentState extends State<CreateTripContent> {
|
||||
firstName: currentUser.prenom,
|
||||
pseudo: currentUser.prenom,
|
||||
role: 'admin',
|
||||
profilePictureUrl: currentUser.profilePictureUrl,
|
||||
),
|
||||
...participantsData.map((p) => GroupMember(
|
||||
userId: p['id'] as String,
|
||||
firstName: p['firstName'] as String,
|
||||
pseudo: p['firstName'] as String,
|
||||
role: 'member',
|
||||
profilePictureUrl: p['profilePictureUrl'] as String?,
|
||||
)),
|
||||
];
|
||||
return groupMembers;
|
||||
@@ -1087,11 +1089,14 @@ class _CreateTripContentState extends State<CreateTripContent> {
|
||||
// Mode mise à jour
|
||||
tripBloc.add(TripUpdateRequested(trip: tripWithCoordinates));
|
||||
|
||||
await _updateGroupMembers(
|
||||
widget.tripToEdit!.id!,
|
||||
currentUser,
|
||||
participantsData,
|
||||
);
|
||||
// Vérifier que l'ID du voyage existe avant de mettre à jour le groupe
|
||||
if (widget.tripToEdit != null && widget.tripToEdit!.id != null && widget.tripToEdit!.id!.isNotEmpty) {
|
||||
await _updateGroupMembers(
|
||||
widget.tripToEdit!.id!,
|
||||
currentUser,
|
||||
participantsData,
|
||||
);
|
||||
}
|
||||
|
||||
} else {
|
||||
// Mode création - Le groupe sera créé dans le listener TripCreated
|
||||
@@ -1113,8 +1118,8 @@ class _CreateTripContentState extends State<CreateTripContent> {
|
||||
}
|
||||
}
|
||||
|
||||
Future<List<Map<String, String>>> _getParticipantsData(List<String> emails) async {
|
||||
List<Map<String, String>> participantsData = [];
|
||||
Future<List<Map<String, dynamic>>> _getParticipantsData(List<String> emails) async {
|
||||
List<Map<String, dynamic>> participantsData = [];
|
||||
|
||||
for (String email in emails) {
|
||||
try {
|
||||
@@ -1122,10 +1127,12 @@ class _CreateTripContentState extends State<CreateTripContent> {
|
||||
if (userId != null) {
|
||||
final userDoc = await _userService.getUserById(userId);
|
||||
final firstName = userDoc?.prenom ?? 'Utilisateur';
|
||||
final profilePictureUrl = userDoc?.profilePictureUrl;
|
||||
|
||||
participantsData.add({
|
||||
'id': userId,
|
||||
'firstName': firstName,
|
||||
'profilePictureUrl': profilePictureUrl,
|
||||
});
|
||||
} else {
|
||||
if (mounted) {
|
||||
|
||||
Reference in New Issue
Block a user