Skip to content

Commit

Permalink
Achievement page (#207)
Browse files Browse the repository at this point in the history
* beginning structure, wip

* Filters mostly working now (except Category)

Filters mostly working now (except Category)

* removed commented code

removed commented code

* Implemented Filtering changes (except for categories)

Implemented Filtering changes (except for categories)

* removed api keys from server env

* Enrollment type enum

* fixed filtering bugs after merging

* added friendly names, fixed category filtering

* Achievements Page UI work

* fixed miles away value in preview

* fix bug where listview breaks

* fix formatting

* Achievements UI no backend

* Achievement model blocked by achievementTracker\

* UI adjustments

* Achievements UI completed, Hint icon fixed

* fixed issues caused by conflict, edited cells on profile page

* removed some old print statements

---------

Co-authored-by: nit0107 <[email protected]>
Co-authored-by: Nitya <[email protected]>
Co-authored-by: cathli66 <[email protected]>
Co-authored-by: neketka <[email protected]>
Co-authored-by: cathli66 <[email protected]>
  • Loading branch information
6 people authored Apr 28, 2024
1 parent e5bca96 commit 9fb3ae8
Show file tree
Hide file tree
Showing 27 changed files with 632 additions and 197 deletions.
4 changes: 2 additions & 2 deletions admin/src/all.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ export interface RequestAchievementDataDto {

export interface LoginDto {
idToken: string;
lat: number;
long: number;
latF: number;
longF: number;
username?: string;
year?: string;
college?: string;
Expand Down
61 changes: 61 additions & 0 deletions game/assets/icons/achievementgold.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions game/assets/icons/achievementsilver.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
58 changes: 29 additions & 29 deletions game/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,48 +1,48 @@
PODS:
- AppAuth (1.7.3):
- AppAuth/Core (= 1.7.3)
- AppAuth/ExternalUserAgent (= 1.7.3)
- AppAuth/Core (1.7.3)
- AppAuth/ExternalUserAgent (1.7.3):
- AppAuth (1.7.4):
- AppAuth/Core (= 1.7.4)
- AppAuth/ExternalUserAgent (= 1.7.4)
- AppAuth/Core (1.7.4)
- AppAuth/ExternalUserAgent (1.7.4):
- AppAuth/Core
- device_info (0.0.1):
- Flutter
- device_info_plus (0.0.1):
- Flutter
- Firebase (10.23.0):
- Firebase/Core (= 10.23.0)
- Firebase/Analytics (10.23.0):
- Firebase (10.24.0):
- Firebase/Core (= 10.24.0)
- Firebase/Analytics (10.24.0):
- Firebase/Core
- Firebase/Core (10.23.0):
- Firebase/Core (10.24.0):
- Firebase/CoreOnly
- FirebaseAnalytics (~> 10.23.0)
- Firebase/CoreOnly (10.23.0):
- FirebaseCore (= 10.23.0)
- FirebaseAnalytics (10.23.0):
- FirebaseAnalytics/AdIdSupport (= 10.23.0)
- FirebaseAnalytics (~> 10.24.0)
- Firebase/CoreOnly (10.24.0):
- FirebaseCore (= 10.24.0)
- FirebaseAnalytics (10.24.0):
- FirebaseAnalytics/AdIdSupport (= 10.24.0)
- FirebaseCore (~> 10.0)
- FirebaseInstallations (~> 10.0)
- GoogleUtilities/AppDelegateSwizzler (~> 7.11)
- GoogleUtilities/MethodSwizzler (~> 7.11)
- GoogleUtilities/Network (~> 7.11)
- "GoogleUtilities/NSData+zlib (~> 7.11)"
- nanopb (< 2.30911.0, >= 2.30908.0)
- FirebaseAnalytics/AdIdSupport (10.23.0):
- FirebaseAnalytics/AdIdSupport (10.24.0):
- FirebaseCore (~> 10.0)
- FirebaseInstallations (~> 10.0)
- GoogleAppMeasurement (= 10.23.0)
- GoogleAppMeasurement (= 10.24.0)
- GoogleUtilities/AppDelegateSwizzler (~> 7.11)
- GoogleUtilities/MethodSwizzler (~> 7.11)
- GoogleUtilities/Network (~> 7.11)
- "GoogleUtilities/NSData+zlib (~> 7.11)"
- nanopb (< 2.30911.0, >= 2.30908.0)
- FirebaseCore (10.23.0):
- FirebaseCore (10.24.0):
- FirebaseCoreInternal (~> 10.0)
- GoogleUtilities/Environment (~> 7.12)
- GoogleUtilities/Logger (~> 7.12)
- FirebaseCoreInternal (10.23.0):
- FirebaseCoreInternal (10.24.0):
- "GoogleUtilities/NSData+zlib (~> 7.8)"
- FirebaseInstallations (10.23.0):
- FirebaseInstallations (10.24.0):
- FirebaseCore (~> 10.0)
- GoogleUtilities/Environment (~> 7.8)
- GoogleUtilities/UserDefaults (~> 7.8)
Expand Down Expand Up @@ -70,14 +70,14 @@ PODS:
- GoogleUtilities/Network (~> 7.11)
- "GoogleUtilities/NSData+zlib (~> 7.11)"
- nanopb (< 2.30911.0, >= 2.30908.0)
- GoogleAppMeasurement/AdIdSupport (10.23.0):
- GoogleAppMeasurement/WithoutAdIdSupport (= 10.23.0)
- GoogleAppMeasurement/AdIdSupport (10.24.0):
- GoogleAppMeasurement/WithoutAdIdSupport (= 10.24.0)
- GoogleUtilities/AppDelegateSwizzler (~> 7.11)
- GoogleUtilities/MethodSwizzler (~> 7.11)
- GoogleUtilities/Network (~> 7.11)
- "GoogleUtilities/NSData+zlib (~> 7.11)"
- nanopb (< 2.30911.0, >= 2.30908.0)
- GoogleAppMeasurement/WithoutAdIdSupport (10.23.0):
- GoogleAppMeasurement/WithoutAdIdSupport (10.24.0):
- GoogleUtilities/AppDelegateSwizzler (~> 7.11)
- GoogleUtilities/MethodSwizzler (~> 7.11)
- GoogleUtilities/Network (~> 7.11)
Expand Down Expand Up @@ -216,15 +216,15 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/url_launcher_ios/ios"

SPEC CHECKSUMS:
AppAuth: a13994980c1ec792f7e2e665acd4d4aa6be43240
AppAuth: 182c5b88630569df5acb672720534756c29b3358
device_info: d7d233b645a32c40dfdc212de5cf646ca482f175
device_info_plus: c6fb39579d0f423935b0c9ce7ee2f44b71b9fce6
Firebase: 333ec7c6b12fa09c77b5162cda6b862102211d50
FirebaseAnalytics: 45f6e2e5ef8ccbb90be73ae983c3b20fa78837f7
FirebaseCore: 63efb128decaebb04c4033ed4e05fb0bb1cccef1
FirebaseCoreInternal: 6a292e6f0bece1243a737e81556e56e5e19282e3
FirebaseInstallations: 42d6ead4605d6eafb3b6683674e80e18eb6f2c35
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
Firebase: 91fefd38712feb9186ea8996af6cbdef41473442
FirebaseAnalytics: b5efc493eb0f40ec560b04a472e3e1a15d39ca13
FirebaseCore: 11dc8a16dfb7c5e3c3f45ba0e191a33ac4f50894
FirebaseCoreInternal: bcb5acffd4ea05e12a783ecf835f2210ce3dc6af
FirebaseInstallations: 8f581fca6478a50705d2bd2abd66d306e0f5736e
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
flutter_config: f48f0d47a284f1791aacce2687eabb3309ba7a41
flutter_secure_storage: 23fc622d89d073675f2eaa109381aefbcf5a49be
fluttertoast: 31b00dabfa7fb7bacd9e7dbee580d7a2ff4bf265
Expand Down
2 changes: 1 addition & 1 deletion game/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1430;
LastUpgradeCheck = 1510;
ORGANIZATIONNAME = "";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1430"
LastUpgradeVersion = "1510"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
159 changes: 159 additions & 0 deletions game/lib/achievements/achievement_cell.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart';
import 'package:game/preview/preview.dart';
import 'package:flutter_svg/flutter_svg.dart';

class LoadingBar extends StatelessWidget {
final int totalTasks;
final int tasksFinished;

const LoadingBar(
this.tasksFinished,
this.totalTasks,
);

@override
Widget build(BuildContext context) {
return Row(
children: [
Container(
width: 200,
child: LayoutBuilder(
builder: (BuildContext context, BoxConstraints constraints) {
return Stack(children: [
Container(
width: constraints.maxWidth,
height: 13,
alignment: Alignment.centerLeft,
child: Container(
decoration: new BoxDecoration(
color: Color.fromARGB(255, 241, 241, 241),
shape: BoxShape.rectangle,
borderRadius: BorderRadius.all(Radius.circular(16.0)),
),
),
),
Container(
width: (totalTasks > 0 ? tasksFinished / totalTasks : 0) *
constraints.maxWidth,
height: 13,
alignment: Alignment.centerLeft,
child: Container(
decoration: new BoxDecoration(
color: Color.fromARGB(197, 237, 86, 86),
shape: BoxShape.rectangle,
borderRadius: BorderRadius.all(Radius.circular(16.0)),
),
),
),
Container(
height: 3,
width: (totalTasks > 0 ? tasksFinished / totalTasks : 0) *
constraints.maxWidth -
16,
margin: EdgeInsets.only(left: 8, top: 3),
alignment: Alignment.centerLeft,
decoration: new BoxDecoration(
color: Color(0x99F3C6C6),
shape: BoxShape.rectangle,
borderRadius: BorderRadius.all(Radius.circular(5.0)),
),
),
]);
})),
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: Text(
tasksFinished.toString() + "/" + totalTasks.toString(),
),
),
],
);
}
}

class AchievementCell extends StatefulWidget {
final SvgPicture thumbnail;
final String description;
final int tasksFinished;
final int totalTasks;

const AchievementCell(
this.description, this.thumbnail, this.tasksFinished, this.totalTasks,
{Key? key})
: super(key: key);

@override
State<StatefulWidget> createState() =>
_AchievementCellState(description, thumbnail, tasksFinished, totalTasks);
}

class _AchievementCellState extends State<AchievementCell> {
final String description;
final SvgPicture thumbnail;
final int tasksFinished;
final int totalTasks;
// newly added field
// final int totalDistance;

_AchievementCellState(
this.description, this.thumbnail, this.tasksFinished, this.totalTasks
// newly added field
// this.totalDistance
);

@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: () async {},
child: Container(
padding: EdgeInsets.all(5),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(15),
boxShadow: [
BoxShadow(
color: Color.fromARGB(255, 198, 198, 198),
blurRadius: 2,
offset: Offset(0, 4),
),
],
),
child: Container(
margin: EdgeInsets.all(10),
height: 64,
child: Row(
children: [
Container(margin: EdgeInsets.only(right: 12), child: thumbnail),
Column(
mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Align(
alignment: Alignment.centerLeft,
child: Text(
description,
style: TextStyle(
color: Color.fromARGB(204, 0, 0, 0),
fontSize: 14,
fontFamily: 'Poppins',
fontWeight: FontWeight.w500,
),
),
),
Spacer(),
Align(
alignment: Alignment.bottomCenter,
child: LoadingBar(3, 4)),
],
)
],
),
),
),
);
}
}
Loading

0 comments on commit 9fb3ae8

Please sign in to comment.