Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AtClub
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
DAI Leslie
AtClub
Commits
9d5970af
Commit
9d5970af
authored
1 year ago
by
RENAULT Juliette
Browse files
Options
Downloads
Patches
Plain Diff
modif profil pour afficher correctement les cartes BDX et president
parent
682feeeb
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
atlub/lib/Pages/profil2.0.dart
+25
-3
25 additions, 3 deletions
atlub/lib/Pages/profil2.0.dart
atlub/lib/Services/database.dart
+6
-6
6 additions, 6 deletions
atlub/lib/Services/database.dart
with
31 additions
and
9 deletions
atlub/lib/Pages/profil2.0.dart
+
25
−
3
View file @
9d5970af
import
'package:atlub/Mods/Profil_assets/carte_club2.0.dart'
;
import
'package:atlub/Mods/Profil_assets/carte_associative2.0.dart'
;
import
'package:atlub/Services/database.dart'
;
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/widgets.dart'
;
...
...
@@ -27,6 +28,7 @@ class _ProfilState extends State<Profil> {
@override
void
initState
()
{
super
.
initState
();
DatabaseService
data
=
DatabaseService
();
// Lecture du profil
widget
.
profil
.
then
((
profilData
)
{
if
(
profilData
.
isNotEmpty
)
{
...
...
@@ -35,16 +37,35 @@ class _ProfilState extends State<Profil> {
prenom
=
profilData
[
0
][
'prenom'
];
description
=
profilData
[
0
][
'description'
];
userid
=
profilData
[
0
][
'uid'
];
profil
=
profilData
[
0
];
if
(
profilData
[
0
][
'statut'
]
!=
null
){
if
(
profilData
[
0
][
'statut'
]
!=
null
)
{
BDX
=
(
profilData
[
0
][
'statut'
][
'BDX'
]
??
[])
.
cast
<
String
>();
president
=
(
profilData
[
0
][
'statut'
][
'president'
]
??
[])
.
cast
<
String
>();
president
=
(
profilData
[
0
][
'statut'
][
'president'
]
??
[])
.
cast
<
String
>();
}
profil
=
profilData
[
0
];
// Déplacer cette ligne ici
});
// Récupérer les BDX associés à l'utilisateur depuis la collection BDX
data
.
getBDXfromUid
(
userid
)
.
then
((
bdxList
)
{
setState
(()
{
BDX
=
bdxList
;
});
});
data
.
getClubsfromUid
(
userid
)
.
then
((
clubIds
)
{
clubIds
.
forEach
((
clubId
)
{
data
.
getClubNom
(
clubId
)
.
then
((
clubName
)
{
setState
(()
{
president
.
add
(
clubName
);
});
});
});
});
}
});
}
@override
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
...
...
@@ -77,6 +98,7 @@ class _ProfilState extends State<Profil> {
],
),
// Crée une AssoCard pour chaque élément de BDX si BDX n'est pas vide
if
(
BDX
.
isNotEmpty
)
Column
(
...
...
This diff is collapsed.
Click to expand it.
atlub/lib/Services/database.dart
+
6
−
6
View file @
9d5970af
...
...
@@ -902,8 +902,8 @@ class DatabaseService {
}
Future
<
Map
<
String
,
dynamic
>>
getClubsfromUid
(
String
userId
)
async
{
Map
<
String
,
dynamic
>
club
data
=
{}
;
Future
<
List
<
String
>>
getClubsfromUid
(
String
userId
)
async
{
List
<
String
>
club
Ids
=
[]
;
QuerySnapshot
<
Map
<
String
,
dynamic
>>
querySnapshot
=
await
FirebaseFirestore
.
instance
.
collection
(
'Presidents'
)
...
...
@@ -912,17 +912,17 @@ class DatabaseService {
if
(
querySnapshot
.
docs
.
isNotEmpty
)
{
for
(
var
document
in
querySnapshot
.
docs
)
{
String
clubid
=
document
[
'idClub'
]
.
id
;
String
type
=
document
[
'type'
];
clubdata
[
clubid
]
=
{
'type'
:
type
};
String
clubId
=
document
[
'idClub'
]
.
id
;
clubIds
.
add
(
clubId
);
}
}
else
{
throw
Exception
(
"L'utilisateur n'est président d'aucun club."
);
}
return
club
data
;
return
club
Ids
;
}
Future
<
List
<
String
>>
getBDXfromUid
(
String
userId
)
async
{
List
<
String
>
BDXnames
=
[];
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment