Equipe sur event details OK

Modif evenement OK
This commit is contained in:
2025-06-03 19:59:40 +02:00
parent acab16e101
commit 57c59c911a
6 changed files with 299 additions and 111 deletions

View File

@ -70,26 +70,15 @@ class _UserMultiSelectState extends State<_UserMultiSelect> {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Wrap(
spacing: 12,
runSpacing: 12,
children: selectedUsers
.map((user) => Chip(
avatar: ProfilePictureWidget(userId: user.uid, radius: 28),
label: Text('${user.firstName} ${user.lastName}',
style: const TextStyle(fontSize: 16)),
labelPadding: const EdgeInsets.symmetric(horizontal: 8),
deleteIcon: const Icon(Icons.close, size: 20),
onDeleted: () {
final newList = List<String>.from(widget.selectedUserIds)
..remove(user.uid);
widget.onChanged(newList);
},
backgroundColor: Colors.grey[200],
padding:
const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
))
.toList(),
UserChipsList(
users: selectedUsers,
selectedUserIds: widget.selectedUserIds,
showRemove: true,
onRemove: (uid) {
final newList = List<String>.from(widget.selectedUserIds)
..remove(uid);
widget.onChanged(newList);
},
),
const SizedBox(height: 16),
ElevatedButton.icon(
@ -188,3 +177,43 @@ class _UserPickerDialogState extends State<_UserPickerDialog> {
);
}
}
class UserChipsList extends StatelessWidget {
final List<UserModel> users;
final List<String> selectedUserIds;
final ValueChanged<String>? onRemove;
final bool showRemove;
final double avatarRadius;
const UserChipsList({
super.key,
required this.users,
this.selectedUserIds = const [],
this.onRemove,
this.showRemove = false,
this.avatarRadius = 28,
});
@override
Widget build(BuildContext context) {
return Wrap(
spacing: 12,
runSpacing: 12,
children: users
.map((user) => Chip(
avatar: ProfilePictureWidget(
userId: user.uid, radius: avatarRadius),
label: Text('${user.firstName} ${user.lastName}',
style: const TextStyle(fontSize: 16)),
labelPadding: const EdgeInsets.symmetric(horizontal: 8),
deleteIcon:
showRemove ? const Icon(Icons.close, size: 20) : null,
onDeleted: showRemove && onRemove != null
? () => onRemove!(user.uid)
: null,
backgroundColor: Colors.grey[200],
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
))
.toList(),
);
}
}