feat: Add user-specific group retrieval and enhance UI with dynamic theming

This commit is contained in:
Dayron
2025-10-11 20:45:14 +02:00
parent 7f4fd610c5
commit 9eb55c358e
5 changed files with 64 additions and 25 deletions

View File

@@ -22,11 +22,11 @@ class _GroupContentState extends State<GroupContent> {
if (user == null || user.id == null) {
return const Center(
child: Text('Utilisateur non connecté'),
);
);
}
return StreamBuilder<List<Group>>(
stream: GroupService().getGroupsStream(),
stream: GroupService().getGroupsStreamByUser(user.id!), // Filtrer par utilisateur
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return _buildLoadingState();
@@ -52,11 +52,11 @@ class _GroupContentState extends State<GroupContent> {
}
final groups = snapshot.data ?? [];
print("Groupes reçus: ${groups.length}");
print("Groupes reçus pour l'utilisateur ${user.id}: ${groups.length}");
return RefreshIndicator(
onRefresh: () async {
setState() {};
setState(() {});
},
child: SingleChildScrollView(
physics: const AlwaysScrollableScrollPhysics(),
@@ -74,13 +74,15 @@ class _GroupContentState extends State<GroupContent> {
),
const SizedBox(height: 20),
groups.isEmpty ? _buildEmptyState() : _buildGroupList(groups),
const SizedBox(height: 80),
],
),
),
);
},
);
}),
},
),
);
}