Skip to content

Commit

Permalink
Profile page (#160)
Browse files Browse the repository at this point in the history
* initial commit

* Documentation

* Added prof img

* Profile page done

* Added svgs

* Minor padding fix

* Updated home page
  • Loading branch information
BrianLa0616 authored Mar 5, 2024
1 parent fe9741a commit a047d69
Show file tree
Hide file tree
Showing 11 changed files with 449 additions and 214 deletions.
3 changes: 3 additions & 0 deletions game/assets/icons/flag.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions game/assets/icons/location.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions game/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import 'package:game/model/event_model.dart';
import 'package:game/model/group_model.dart';
import 'package:game/model/tracker_model.dart';
import 'package:game/model/user_model.dart';
import 'package:game/profile/profile_page.dart';
import 'package:game/splash_page/splash_page.dart';
import 'package:game/widget/game_widget.dart';
import 'package:provider/provider.dart';
Expand Down
114 changes: 114 additions & 0 deletions game/lib/profile/achievement_cell.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:game/utils/utility_functions.dart';

/**
* Widget that represents each individual achievement
* @param name: Name of the achievement
* @param tasksFinished: Number of currently completed tasks towards the achievement
* @param totalTasks: Total number of tasks needed to gain achievement
* @param picture: picture that is associated with the achievement
*/
Widget achievementCell(
String name, int tasksFinished, int totalTasks, String picture) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
width: 380,
height: 100,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(10.0),
boxShadow: [
BoxShadow(
color: Color.fromRGBO(0, 0, 0, 0.25),
offset: Offset(0, 4),
blurRadius: 4,
),
]),
child: Row(
children: [
Padding(
padding: const EdgeInsets.only(
left: 18.0, top: 15, bottom: 15, right: 15),
child: ClipRRect(
borderRadius: BorderRadius.circular(20),
child: Image(
width: 80,
height: 80,
image: AssetImage(picture),
fit: BoxFit.cover,
)),
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Container(
width: 250,
child: Text(
name,
overflow: TextOverflow.ellipsis,
maxLines: 2,
style: TextStyle(
fontWeight: FontWeight.w500,
),
),
),
],
),
),
Row(
children: [
Stack(children: [
Container(
width: 200,
height: 20,
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) *
200,
height: 20,
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)),
),
),
),
]),
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: SvgPicture.asset("assets/icons/location.svg"),
),
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: Text(
tasksFinished.toString() + "/" + totalTasks.toString(),
),
),
],
),
],
)
],
)),
);
}
154 changes: 154 additions & 0 deletions game/lib/profile/completed_cell.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:game/utils/utility_functions.dart';

/**
* Widget that represents each individual completed journey or challenge
* @param name: Name of the challenge or journey completed
* @param type: an enum of type CompeltedType either a journey or challenge
* @param date: Date that the journey / challenge was completed
* @param location: picture that is associated with the achievement
* @param difficulty: level of the task, either easy, medium, or hard
* @param points: Points that the completed journey / challenge had
*/
Widget completedCell(String name, String picture, String type, String date,
String location, String difficulty, int points) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
width: 380,
height: 100,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(10.0),
boxShadow: [
BoxShadow(
color: Color.fromRGBO(0, 0, 0, 0.25),
offset: Offset(0, 4),
blurRadius: 4,
),
]),
child: Row(
children: [
Padding(
padding: const EdgeInsets.only(
left: 18.0, top: 15, bottom: 15, right: 15),
child: ClipRRect(
borderRadius: BorderRadius.circular(20),
child: Image(
width: 80,
height: 80,
image: AssetImage(picture),
fit: BoxFit.cover,
)),
),
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.only(top: 8.0),
child: Text(
name,
overflow: TextOverflow.ellipsis,
maxLines: 1,
style: TextStyle(
fontWeight: FontWeight.bold,
),
),
),
Row(
children: [
Text(
"From " + type + " - ",
style: TextStyle(color: Colors.grey),
),
Text(date)
],
),
Padding(
padding: const EdgeInsets.only(top: 8.0),
child: Container(
width: 200,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
width: 80,
height: 30,
decoration: BoxDecoration(
border: Border.all(
color: Colors.purple, // Set the outline color
width: 2.0, // Set the outline width
),
borderRadius: BorderRadius.circular(
15.0), // Set border radius
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SvgPicture.asset(
'assets/icons/flag.svg',
),
Text(
location,
style: TextStyle(
color: Colors.purple,
fontSize: 10,
),
),
],
),
),
Container(
width: 50,
height: 30,
decoration: BoxDecoration(
color: Color.fromRGBO(249, 236, 217, 1),
borderRadius: BorderRadius.circular(
20.0), // Set border radius
),
child: Center(
child: Text(
difficulty,
style: TextStyle(
fontSize: 10,
),
),
),
),
Container(
width: 50,
height: 30,
decoration: BoxDecoration(
border: Border.all(
color: Color.fromRGBO(
189, 135, 31, 1), // Set the outline color
width: 1.38, // Set the outline width
),
color: Color.fromRGBO(255, 199, 55, 1),
borderRadius: BorderRadius.circular(
15.0), // Set border radius
),
child: Center(
child: Text(
points.toString() + " PTS",
style: TextStyle(
fontSize: 10,
),
),
),
)
],
),
),
),
],
),
)
],
)),
);
}
Loading

0 comments on commit a047d69

Please sign in to comment.