Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Profile page #151

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
3 changes: 2 additions & 1 deletion game/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import 'package:game/model/group_model.dart';
import 'package:game/model/reward_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 Expand Up @@ -81,7 +82,7 @@ class MyApp extends StatelessWidget {
supportedLocales: const [Locale('en', '')],
theme: ThemeData(
fontFamily: 'Poppins', primarySwatch: ColorPalette.BigRed),
home: SplashPageWidget(),
home: ProfilePage(),
)));
}
}
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
Loading