Skip to content

Commit

Permalink
Upvote Color Change
Browse files Browse the repository at this point in the history
  • Loading branch information
shubhanshu02 committed Nov 17, 2020
1 parent 6c9fd1e commit 3759ae7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
4 changes: 2 additions & 2 deletions lib/feedCard.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class ComplaintOverviewCard extends StatefulWidget {
}

class _ComplaintOverviewCardState extends State<ComplaintOverviewCard> {
var upvoteArray;
List upvoteArray;

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -164,7 +164,7 @@ class _ComplaintOverviewCardState extends State<ComplaintOverviewCard> {
Column(
children: <Widget>[
IconButton(
icon: Icon(Icons.arrow_upward),
icon: Icon(Icons.arrow_upward,color: (upvoteArray.contains(FirebaseAuth.instance.currentUser.uid))?Colors.blue[400]:Colors.black,),
onPressed: () async {
final complaint = await FirebaseFirestore.instance
.collection('complaints')
Expand Down
24 changes: 13 additions & 11 deletions lib/filed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -206,17 +206,19 @@ class _ComplaintTile1State extends State<ComplaintTile1> {
return Loading();
case ConnectionState.done:
if (user.hasError) return Text('Error: ${user.error}');
return ComplaintOverviewCard(
title: user.data["title"],
onTap: ComplaintDialog(user.data.id),
email: user.data['email'],
filingTime: user.data['filing time'],
category: user.data["category"],
description: user.data["description"],
status: user.data["status"],
upvotes: user.data['upvotes'],
id: user.data.id,
);
if (user.data["status"] != 'Solved')
return ComplaintOverviewCard(
title: user.data["title"],
onTap: ComplaintDialog(user.data.id),
email: user.data['email'],
filingTime: user.data['filing time'],
category: user.data["category"],
description: user.data["description"],
status: user.data["status"],
upvotes: user.data['upvotes'],
id: user.data.id,
);
return Container();
}
return null; // unreachable
},
Expand Down

0 comments on commit 3759ae7

Please sign in to comment.