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
448750c7
Commit
448750c7
authored
1 year ago
by
RENAULT Juliette
Browse files
Options
Downloads
Patches
Plain Diff
modif club accessible au président de ce club mais pas au coprez
parent
e8b19a6e
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/Mods/list_club_assets/club.dart
+38
-16
38 additions, 16 deletions
atlub/lib/Mods/list_club_assets/club.dart
atlub/lib/userprovider.dart
+13
-0
13 additions, 0 deletions
atlub/lib/userprovider.dart
with
51 additions
and
16 deletions
atlub/lib/Mods/list_club_assets/club.dart
+
38
−
16
View file @
448750c7
...
...
@@ -18,11 +18,13 @@ class Club extends StatefulWidget {
class
_ClubState
extends
State
<
Club
>
{
late
Future
<
String
?
>
descriptionFuture
;
late
Future
<
bool
>
isUserClubPrezFuture
;
@override
void
initState
()
{
super
.
initState
();
descriptionFuture
=
getClubDescription
();
isUserClubPrezFuture
=
isUserClubPresident
();
}
Future
<
String
?
>
getClubDescription
()
{
...
...
@@ -30,6 +32,11 @@ class _ClubState extends State<Club> {
return
db
.
getClubDescription
(
widget
.
clubid
);
}
Future
<
bool
>
isUserClubPresident
()
{
DatabaseService
db
=
DatabaseService
();
return
db
.
isUserClubPresident
(
widget
.
clubid
);
}
@override
Widget
build
(
BuildContext
context
)
{
DatabaseService
db
=
DatabaseService
();
...
...
@@ -173,23 +180,38 @@ class _ClubState extends State<Club> {
),
),
FollowButton
(
clubid:
widget
.
clubid
),
// Utilisation du widget FollowButton
if
(
userinBDX
[
widget
.
clubData
?
[
'BDX'
]]
??
false
)
GestureDetector
(
onTap:
()
{
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=
>
ModClub
(
idClub:
widget
.
clubid
)),
FutureBuilder
<
bool
>(
future:
isUserClubPrezFuture
,
builder:
(
context
,
snapshot
)
{
if
(
snapshot
.
connectionState
==
ConnectionState
.
waiting
)
{
return
const
SizedBox
.
shrink
();
}
if
(
snapshot
.
hasError
)
{
return
const
Text
(
'Erreur'
);
}
final
isUserClubPrez
=
snapshot
.
data
??
false
;
if
((
userinBDX
[
widget
.
clubData
?
[
'BDX'
]]
??
false
)
||
isUserClubPrez
)
{
return
GestureDetector
(
onTap:
()
{
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=
>
ModClub
(
idClub:
widget
.
clubid
)),
);
},
child:
Chip
(
label:
Text
(
'Modifier'
,
style:
Theme
.
of
(
context
)
.
textTheme
.
titleMedium
?.
copyWith
(
color:
AppColor
.
white
),
),
side:
BorderSide
.
none
,
backgroundColor:
AppColor
.
turquoiseBlue
,
),
);
},
child:
Chip
(
label:
Text
(
'Modifier'
,
style:
Theme
.
of
(
context
)
.
textTheme
.
titleMedium
?.
copyWith
(
color:
AppColor
.
white
),
),
side:
BorderSide
.
none
,
backgroundColor:
AppColor
.
turquoiseBlue
,
),
),
}
else
{
return
const
SizedBox
.
shrink
();
}
},
),
],
),
],
...
...
This diff is collapsed.
Click to expand it.
atlub/lib/userprovider.dart
+
13
−
0
View file @
448750c7
...
...
@@ -260,6 +260,19 @@ class UserProvider extends ChangeNotifier {
notifyListeners
();
}
Future
<
List
<
String
>>
getUserPrezOfClubs
()
async
{
User
?
user
=
FirebaseAuth
.
instance
.
currentUser
;
DocumentReference
userRef
=
FirebaseFirestore
.
instance
.
collection
(
'Profils'
)
.
doc
(
user
!.
uid
);
QuerySnapshot
querySnapshot
=
await
FirebaseFirestore
.
instance
.
collection
(
'Presidents'
)
.
where
(
'uid'
,
isEqualTo:
userRef
)
.
get
();
List
<
String
>
clubIds
=
querySnapshot
.
docs
.
map
((
doc
)
=
>
doc
[
'clubId'
]
as
String
)
.
toList
();
return
clubIds
;
}
Future
<
void
>
checkcurrentuserinpresident
()
async
{
User
?
user
=
FirebaseAuth
.
instance
.
currentUser
;
DocumentReference
userRef
=
FirebaseFirestore
.
instance
.
collection
(
'Profils'
)
.
doc
(
user
!.
uid
);
...
...
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