Skip to content

Commit

Permalink
Merge pull request #12 from BU-Spark/leaderboard
Browse files Browse the repository at this point in the history
Leaderboard
  • Loading branch information
lcfmarco authored Apr 24, 2024
2 parents e771238 + 38071e2 commit b61d208
Show file tree
Hide file tree
Showing 30 changed files with 7,015 additions and 6,403 deletions.
Binary file added bu_passport/assets/images/leaderboard/diamond.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bu_passport/assets/images/leaderboard/gold.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bu_passport/assets/images/leaderboard/silver.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bu_passport/assets/images/leaderboard/ticket.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion bu_passport/ios/.symlinks/plugins/cloud_firestore
2 changes: 1 addition & 1 deletion bu_passport/ios/.symlinks/plugins/firebase_auth
2 changes: 1 addition & 1 deletion bu_passport/ios/.symlinks/plugins/firebase_core
2 changes: 1 addition & 1 deletion bu_passport/ios/.symlinks/plugins/firebase_storage
2 changes: 1 addition & 1 deletion bu_passport/ios/.symlinks/plugins/geolocator_apple
2 changes: 1 addition & 1 deletion bu_passport/ios/.symlinks/plugins/google_maps_flutter_ios
2 changes: 1 addition & 1 deletion bu_passport/ios/.symlinks/plugins/image_picker_ios
2 changes: 1 addition & 1 deletion bu_passport/ios/.symlinks/plugins/permission_handler_apple
2 changes: 1 addition & 1 deletion bu_passport/ios/.symlinks/plugins/url_launcher_ios
8 changes: 4 additions & 4 deletions bu_passport/ios/Flutter/Generated.xcconfig
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// This is a generated file; do not edit or check into version control.
FLUTTER_ROOT=/Users/marcolam/flutter
FLUTTER_APPLICATION_PATH=/Users/marcolam/se-bu-passport-arts/bu_passport
FLUTTER_ROOT=/Users/saisriram/development/flutter
FLUTTER_APPLICATION_PATH=/Users/saisriram/Desktop/BUPassport/se-bu-passport-arts/bu_passport
COCOAPODS_PARALLEL_CODE_SIGN=true
FLUTTER_TARGET=/Users/marcolam/se-bu-passport-arts/bu_passport/lib/main.dart
FLUTTER_TARGET=/Users/saisriram/Desktop/BUPassport/se-bu-passport-arts/bu_passport/lib/main.dart
FLUTTER_BUILD_DIR=build
FLUTTER_BUILD_NAME=1.0.0
FLUTTER_BUILD_NUMBER=1
Expand All @@ -12,4 +12,4 @@ DART_DEFINES=RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ==,RkxVVFRFUl9XRUJfQ0FOVkFTS0
DART_OBFUSCATION=false
TRACK_WIDGET_CREATION=true
TREE_SHAKE_ICONS=false
PACKAGE_CONFIG=/Users/marcolam/se-bu-passport-arts/bu_passport/.dart_tool/package_config.json
PACKAGE_CONFIG=/Users/saisriram/Desktop/BUPassport/se-bu-passport-arts/bu_passport/.dart_tool/package_config.json
8 changes: 4 additions & 4 deletions bu_passport/ios/Flutter/flutter_export_environment.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/bin/sh
# This is a generated file; do not edit or check into version control.
export "FLUTTER_ROOT=/Users/marcolam/flutter"
export "FLUTTER_APPLICATION_PATH=/Users/marcolam/se-bu-passport-arts/bu_passport"
export "FLUTTER_ROOT=/Users/saisriram/development/flutter"
export "FLUTTER_APPLICATION_PATH=/Users/saisriram/Desktop/BUPassport/se-bu-passport-arts/bu_passport"
export "COCOAPODS_PARALLEL_CODE_SIGN=true"
export "FLUTTER_TARGET=/Users/marcolam/se-bu-passport-arts/bu_passport/lib/main.dart"
export "FLUTTER_TARGET=/Users/saisriram/Desktop/BUPassport/se-bu-passport-arts/bu_passport/lib/main.dart"
export "FLUTTER_BUILD_DIR=build"
export "FLUTTER_BUILD_NAME=1.0.0"
export "FLUTTER_BUILD_NUMBER=1"
export "DART_DEFINES=RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ==,RkxVVFRFUl9XRUJfQ0FOVkFTS0lUX1VSTD1odHRwczovL3d3dy5nc3RhdGljLmNvbS9mbHV0dGVyLWNhbnZhc2tpdC8wNDgxN2M5OWM5ZmQ0OTU2ZjI3NTA1MjA0ZjdlMzQ0MzM1ODEwYWVkLw=="
export "DART_OBFUSCATION=false"
export "TRACK_WIDGET_CREATION=true"
export "TREE_SHAKE_ICONS=false"
export "PACKAGE_CONFIG=/Users/marcolam/se-bu-passport-arts/bu_passport/.dart_tool/package_config.json"
export "PACKAGE_CONFIG=/Users/saisriram/Desktop/BUPassport/se-bu-passport-arts/bu_passport/.dart_tool/package_config.json"
12,892 changes: 6,527 additions & 6,365 deletions bu_passport/ios/Pods/Pods.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions bu_passport/lib/classes/event.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class Event {
final String eventURL;
final DateTime eventStartTime;
final DateTime eventEndTime;
final int eventPoints;
final List<String> savedUsers;

Event({
Expand All @@ -19,6 +20,7 @@ class Event {
required this.eventStartTime,
required this.eventEndTime,
required this.eventDescription,
required this.eventPoints,
required this.eventURL,
required this.savedUsers,
});
Expand Down
6 changes: 2 additions & 4 deletions bu_passport/lib/classes/user.dart
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@
class Users {
final String firstName;
final String lastName;
final String profileImageUrl;
final String userBUID;
final String userEmail;
final String userSchool;
final String userUID;
final int userYear;
final int userPoints;
final List<String> userPreferences;
final String userProfileURL;
final Map<String, dynamic> userSavedEvents;

Users({
required this.firstName,
required this.lastName,
required this.profileImageUrl,
required this.userBUID,
required this.userEmail,
required this.userSchool,
required this.userUID,
required this.userYear,
required this.userPreferences,
required this.userSavedEvents,
required this.userPoints,
required this.userProfileURL,
});
}
6 changes: 2 additions & 4 deletions bu_passport/lib/components/event_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class _EventWidgetState extends State<EventWidget> {
child: Stack(
children: [
Positioned(
bottom: sizedBoxHeight,
bottom: widgetHeight * 0.01,
left: edgeInsets,
right: edgeInsets,
child: Container(
Expand Down Expand Up @@ -144,9 +144,7 @@ class _EventWidgetState extends State<EventWidget> {
),
RichText(
text: TextSpan(
// text: '${widget.event.points}',
// It will be replaced with real value in future development
text: '30',
text: '${widget.event.eventPoints}',
style: TextStyle(
fontSize: 24.0,
fontWeight: FontWeight.w800,
Expand Down
75 changes: 75 additions & 0 deletions bu_passport/lib/components/user_widget.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import 'package:bu_passport/classes/user.dart';
import 'package:flutter/material.dart';

class UserRankWidget extends StatelessWidget {
final int rank;
final Users user;

const UserRankWidget({Key? key, required this.rank, required this.user})
: super(key: key);

@override
Widget build(BuildContext context) {
double screenWidth = MediaQuery.of(context).size.width;
double screenHeight = MediaQuery.of(context).size.height;

double sizedBoxHeight = screenHeight * 0.05;
double sizedBoxWidth = screenWidth * 0.02;

double edgeInsets = (MediaQuery.of(context).size.width * 0.02);

double imageHeight = screenHeight * 0.05;
double imageWidth = screenWidth * 0.05;

return Container(
padding: EdgeInsets.all(edgeInsets),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10.0), // Set border radius
color: Color.fromARGB(204, 235, 242, 250), // Set background color
),
child: Row(
children: [
Text(
"$rank",
style: TextStyle(
fontSize: 22.0,
fontWeight: rank <= 3 ? FontWeight.bold : FontWeight.normal,
color: rank <= 3 ? const Color(0xFFCC0000) : Colors.black,
),
),
SizedBox(width: 16), // Adjust spacing between rank and avatar
CircleAvatar(
backgroundImage: NetworkImage(user.userProfileURL),
radius: 30.0,
),
SizedBox(width: 16), // Adjust spacing between avatar and name
Text(
"${user.firstName} ${user.lastName}",
style: TextStyle(
fontSize: 18.0,
fontWeight: rank <= 3 ? FontWeight.bold : FontWeight.normal,
color: rank <= 3 ? const Color(0xFFCC0000) : Colors.black,
),
),
Spacer(), // This pushes the next widget to the right
Image(
image: AssetImage('assets/images/leaderboard/ticket.png'),
width: imageWidth,
height: imageHeight,
),
SizedBox(
width:
sizedBoxWidth), // Adjust spacing between ticket image and text
Text(
// if only 1 ticket, display "1 Ticket" else display "x Tickets"
"${user.userPoints ~/ 100} ${user.userPoints ~/ 100 == 1 ? 'Ticket' : 'Tickets'}",
style: TextStyle(
fontSize: 14.0,
color: const Color(0xFFCC0000),
),
),
],
),
);
}
}
3 changes: 2 additions & 1 deletion bu_passport/lib/pages/event_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,8 @@ class _EventPageState extends State<EventPage> {
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content: Text("Checked in successfully!")));
FirebaseService.checkInUserForEvent(
widget.event.eventID);
widget.event.eventID,widget.event.eventPoints);

widget.onUpdateEventPage();
} else {
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
Expand Down
6 changes: 4 additions & 2 deletions bu_passport/lib/pages/explore_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@ class _HomePageState extends State<ExplorePage> {
@override
void initState() {
super.initState();
fetchEventsFuture = FirebaseService.fetchEvents();
fetchEventsFuture = FirebaseService.fetchEventsFromNow();
}

// not the most effiicent solution need to improve **

void updateEventPage() {
setState(() {
fetchEventsFuture = FirebaseService.fetchEvents();
fetchEventsFuture = FirebaseService.fetchEventsFromNow();
});
}

Expand Down
Loading

0 comments on commit b61d208

Please sign in to comment.