Commit b4044803 authored by Piyumi Dayarathna's avatar Piyumi Dayarathna 💬

Responsiveness in STracker

parent 7aaf5cbc
...@@ -73,7 +73,7 @@ class _maskWearingResultPageState extends State<maskWearingResultPage> { ...@@ -73,7 +73,7 @@ class _maskWearingResultPageState extends State<maskWearingResultPage> {
child: Text( child: Text(
"You Scored $marks marks", "You Scored $marks marks",
style: TextStyle( style: TextStyle(
fontSize: 30.0, fontSize: 20.0,
fontWeight: FontWeight.w900, fontWeight: FontWeight.w900,
), ),
), ),
...@@ -99,8 +99,8 @@ class _maskWearingResultPageState extends State<maskWearingResultPage> { ...@@ -99,8 +99,8 @@ class _maskWearingResultPageState extends State<maskWearingResultPage> {
), ),
), ),
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
vertical: 20.0, vertical: 10.0,
horizontal: 200.0, horizontal: 50.0,
), ),
) )
], ],
......
...@@ -5,7 +5,6 @@ import 'package:covidefender/STracker/PublicPlaces/publicPlacesResultPage.dart'; ...@@ -5,7 +5,6 @@ import 'package:covidefender/STracker/PublicPlaces/publicPlacesResultPage.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
class getjsonPublicPlaces extends StatelessWidget { class getjsonPublicPlaces extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
...@@ -37,7 +36,8 @@ class quizpagePublicPlaces extends StatefulWidget { ...@@ -37,7 +36,8 @@ class quizpagePublicPlaces extends StatefulWidget {
quizpagePublicPlaces({Key key, @required this.mydata}) : super(key: key); quizpagePublicPlaces({Key key, @required this.mydata}) : super(key: key);
@override @override
_quizpagePublicPlacesState createState() => _quizpagePublicPlacesState(mydata); _quizpagePublicPlacesState createState() =>
_quizpagePublicPlacesState(mydata);
} }
class _quizpagePublicPlacesState extends State<quizpagePublicPlaces> { class _quizpagePublicPlacesState extends State<quizpagePublicPlaces> {
...@@ -145,7 +145,7 @@ class _quizpagePublicPlacesState extends State<quizpagePublicPlaces> { ...@@ -145,7 +145,7 @@ class _quizpagePublicPlacesState extends State<quizpagePublicPlaces> {
Widget choicebutton(String k) { Widget choicebutton(String k) {
return Padding( return Padding(
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
vertical: 20.0, vertical: 10.0,
horizontal: 20.0, horizontal: 20.0,
), ),
child: MaterialButton( child: MaterialButton(
...@@ -154,15 +154,15 @@ class _quizpagePublicPlacesState extends State<quizpagePublicPlaces> { ...@@ -154,15 +154,15 @@ class _quizpagePublicPlacesState extends State<quizpagePublicPlaces> {
mydata[1][i.toString()][k], mydata[1][i.toString()][k],
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
fontSize: 20.0, fontSize: 15.0,
), ),
maxLines: 1, maxLines: 1,
), ),
color: btncolor[k], color: btncolor[k],
splashColor: Colors.indigo[700], splashColor: Colors.indigo[700],
highlightColor: Colors.indigo[700], highlightColor: Colors.indigo[700],
minWidth: 500.0, minWidth: 300.0,
height: 70.0, height: 40.0,
shape: shape:
RoundedRectangleBorder(borderRadius: BorderRadius.circular(20.0)), RoundedRectangleBorder(borderRadius: BorderRadius.circular(20.0)),
), ),
...@@ -202,14 +202,14 @@ class _quizpagePublicPlacesState extends State<quizpagePublicPlaces> { ...@@ -202,14 +202,14 @@ class _quizpagePublicPlacesState extends State<quizpagePublicPlaces> {
child: Material( child: Material(
elevation: 20.0, elevation: 20.0,
child: Container( child: Container(
width: 400.0, width: 300.0,
height: 50.0, height: 50.0,
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
Material( Material(
child: Container( child: Container(
width: 400.0, width: 200.0,
height: 375.0, height: 200.0,
child: ClipRRect( child: ClipRRect(
child: Image( child: Image(
image: AssetImage( image: AssetImage(
...@@ -222,15 +222,18 @@ class _quizpagePublicPlacesState extends State<quizpagePublicPlaces> { ...@@ -222,15 +222,18 @@ class _quizpagePublicPlacesState extends State<quizpagePublicPlaces> {
)), )),
), ),
), ),
SizedBox(
height: 10,
),
Expanded( Expanded(
flex: 1, flex: 1,
child: Container( child: Container(
padding: EdgeInsets.all(15.0), padding: EdgeInsets.all(0.0),
alignment: Alignment.bottomLeft, alignment: Alignment.bottomLeft,
child: Text( child: Text(
mydata[0][i.toString()], mydata[0][i.toString()],
style: TextStyle( style: TextStyle(
fontSize: 30.0, fontSize: 15.0,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
), ),
), ),
...@@ -261,7 +264,7 @@ class _quizpagePublicPlacesState extends State<quizpagePublicPlaces> { ...@@ -261,7 +264,7 @@ class _quizpagePublicPlacesState extends State<quizpagePublicPlaces> {
child: Text( child: Text(
showtimer, showtimer,
style: TextStyle( style: TextStyle(
fontSize: 35.0, fontSize: 30.0,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
), ),
), ),
......
...@@ -80,7 +80,7 @@ class _publicPlacesQuizStartPageState extends State<publicPlacesQuizStartPage> { ...@@ -80,7 +80,7 @@ class _publicPlacesQuizStartPageState extends State<publicPlacesQuizStartPage> {
body: Column( body: Column(
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
flex: 1, flex: 2,
child: ButtonTheme( child: ButtonTheme(
minWidth: 800.0, minWidth: 800.0,
height: 100.0, height: 100.0,
...@@ -144,8 +144,8 @@ class _publicPlacesQuizStartPageState extends State<publicPlacesQuizStartPage> { ...@@ -144,8 +144,8 @@ class _publicPlacesQuizStartPageState extends State<publicPlacesQuizStartPage> {
), ),
), ),
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
vertical: 20.0, vertical: 10.0,
horizontal: 200.0, horizontal: 50.0,
), ),
) )
], ],
......
...@@ -73,7 +73,7 @@ class _publicPlacesResultPageState extends State<publicPlacesResultPage> { ...@@ -73,7 +73,7 @@ class _publicPlacesResultPageState extends State<publicPlacesResultPage> {
child: Text( child: Text(
"You Scored $marks marks", "You Scored $marks marks",
style: TextStyle( style: TextStyle(
fontSize: 30.0, fontSize: 20.0,
fontWeight: FontWeight.w900, fontWeight: FontWeight.w900,
), ),
), ),
...@@ -99,8 +99,8 @@ class _publicPlacesResultPageState extends State<publicPlacesResultPage> { ...@@ -99,8 +99,8 @@ class _publicPlacesResultPageState extends State<publicPlacesResultPage> {
), ),
), ),
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
vertical: 20.0, vertical: 10.0,
horizontal: 200.0, horizontal: 50.0,
), ),
) )
], ],
......
...@@ -145,7 +145,7 @@ class _quizpageSocialDistanceState extends State<quizpageSocialDistance> { ...@@ -145,7 +145,7 @@ class _quizpageSocialDistanceState extends State<quizpageSocialDistance> {
Widget choicebutton(String k) { Widget choicebutton(String k) {
return Padding( return Padding(
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
vertical: 20.0, vertical: 10.0,
horizontal: 20.0, horizontal: 20.0,
), ),
child: MaterialButton( child: MaterialButton(
...@@ -154,15 +154,15 @@ class _quizpageSocialDistanceState extends State<quizpageSocialDistance> { ...@@ -154,15 +154,15 @@ class _quizpageSocialDistanceState extends State<quizpageSocialDistance> {
mydata[1][i.toString()][k], mydata[1][i.toString()][k],
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
fontSize: 20.0, fontSize: 15.0,
), ),
maxLines: 1, maxLines: 1,
), ),
color: btncolor[k], color: btncolor[k],
splashColor: Colors.indigo[700], splashColor: Colors.indigo[700],
highlightColor: Colors.indigo[700], highlightColor: Colors.indigo[700],
minWidth: 500.0, minWidth: 300.0,
height: 70.0, height: 40.0,
shape: shape:
RoundedRectangleBorder(borderRadius: BorderRadius.circular(20.0)), RoundedRectangleBorder(borderRadius: BorderRadius.circular(20.0)),
), ),
...@@ -202,14 +202,14 @@ class _quizpageSocialDistanceState extends State<quizpageSocialDistance> { ...@@ -202,14 +202,14 @@ class _quizpageSocialDistanceState extends State<quizpageSocialDistance> {
child: Material( child: Material(
elevation: 20.0, elevation: 20.0,
child: Container( child: Container(
width: 400.0, width: 300.0,
height: 50.0, height: 50.0,
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
Material( Material(
child: Container( child: Container(
width: 400.0, width: 200.0,
height: 375.0, height: 200.0,
child: ClipRRect( child: ClipRRect(
child: Image( child: Image(
image: AssetImage( image: AssetImage(
...@@ -222,15 +222,18 @@ class _quizpageSocialDistanceState extends State<quizpageSocialDistance> { ...@@ -222,15 +222,18 @@ class _quizpageSocialDistanceState extends State<quizpageSocialDistance> {
)), )),
), ),
), ),
SizedBox(
height: 10,
),
Expanded( Expanded(
flex: 1, flex: 1,
child: Container( child: Container(
padding: EdgeInsets.all(15.0), padding: EdgeInsets.all(0.0),
alignment: Alignment.bottomLeft, alignment: Alignment.bottomLeft,
child: Text( child: Text(
mydata[0][i.toString()], mydata[0][i.toString()],
style: TextStyle( style: TextStyle(
fontSize: 30.0, fontSize: 15.0,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
), ),
), ),
...@@ -261,7 +264,7 @@ class _quizpageSocialDistanceState extends State<quizpageSocialDistance> { ...@@ -261,7 +264,7 @@ class _quizpageSocialDistanceState extends State<quizpageSocialDistance> {
child: Text( child: Text(
showtimer, showtimer,
style: TextStyle( style: TextStyle(
fontSize: 35.0, fontSize: 30.0,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
), ),
), ),
......
...@@ -145,8 +145,8 @@ class _socialDistanceQuizStartPageState ...@@ -145,8 +145,8 @@ class _socialDistanceQuizStartPageState
), ),
), ),
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
vertical: 20.0, vertical: 10.0,
horizontal: 200.0, horizontal: 50.0,
), ),
) )
], ],
......
...@@ -73,7 +73,7 @@ class _socialDistanceResultPageState extends State<socialDistanceResultPage> { ...@@ -73,7 +73,7 @@ class _socialDistanceResultPageState extends State<socialDistanceResultPage> {
child: Text( child: Text(
"You Scored $marks marks", "You Scored $marks marks",
style: TextStyle( style: TextStyle(
fontSize: 30.0, fontSize: 20.0,
fontWeight: FontWeight.w900, fontWeight: FontWeight.w900,
), ),
), ),
...@@ -99,8 +99,8 @@ class _socialDistanceResultPageState extends State<socialDistanceResultPage> { ...@@ -99,8 +99,8 @@ class _socialDistanceResultPageState extends State<socialDistanceResultPage> {
), ),
), ),
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
vertical: 20.0, vertical: 10.0,
horizontal: 200.0, horizontal: 50.0,
), ),
) )
], ],
......
...@@ -144,7 +144,7 @@ class _quizpageSymptomsState extends State<quizpageSymptoms> { ...@@ -144,7 +144,7 @@ class _quizpageSymptomsState extends State<quizpageSymptoms> {
Widget choicebutton(String k) { Widget choicebutton(String k) {
return Padding( return Padding(
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
vertical: 20.0, vertical: 10.0,
horizontal: 20.0, horizontal: 20.0,
), ),
child: MaterialButton( child: MaterialButton(
...@@ -153,15 +153,15 @@ class _quizpageSymptomsState extends State<quizpageSymptoms> { ...@@ -153,15 +153,15 @@ class _quizpageSymptomsState extends State<quizpageSymptoms> {
mydata[1][i.toString()][k], mydata[1][i.toString()][k],
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
fontSize: 20.0, fontSize: 15.0,
), ),
maxLines: 1, maxLines: 1,
), ),
color: btncolor[k], color: btncolor[k],
splashColor: Colors.indigo[700], splashColor: Colors.indigo[700],
highlightColor: Colors.indigo[700], highlightColor: Colors.indigo[700],
minWidth: 500.0, minWidth: 300.0,
height: 70.0, height: 40.0,
shape: shape:
RoundedRectangleBorder(borderRadius: BorderRadius.circular(20.0)), RoundedRectangleBorder(borderRadius: BorderRadius.circular(20.0)),
), ),
...@@ -201,14 +201,14 @@ class _quizpageSymptomsState extends State<quizpageSymptoms> { ...@@ -201,14 +201,14 @@ class _quizpageSymptomsState extends State<quizpageSymptoms> {
child: Material( child: Material(
elevation: 20.0, elevation: 20.0,
child: Container( child: Container(
width: 400.0, width: 300.0,
height: 50.0, height: 50.0,
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
Material( Material(
child: Container( child: Container(
width: 400.0, width: 200.0,
height: 375.0, height: 200.0,
child: ClipRRect( child: ClipRRect(
child: Image( child: Image(
image: AssetImage( image: AssetImage(
...@@ -221,15 +221,18 @@ class _quizpageSymptomsState extends State<quizpageSymptoms> { ...@@ -221,15 +221,18 @@ class _quizpageSymptomsState extends State<quizpageSymptoms> {
)), )),
), ),
), ),
SizedBox(
height: 10,
),
Expanded( Expanded(
flex: 1, flex: 1,
child: Container( child: Container(
padding: EdgeInsets.all(15.0), padding: EdgeInsets.all(0.0),
alignment: Alignment.bottomLeft, alignment: Alignment.bottomLeft,
child: Text( child: Text(
mydata[0][i.toString()], mydata[0][i.toString()],
style: TextStyle( style: TextStyle(
fontSize: 20.0, fontSize: 15.0,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
), ),
), ),
...@@ -260,7 +263,7 @@ class _quizpageSymptomsState extends State<quizpageSymptoms> { ...@@ -260,7 +263,7 @@ class _quizpageSymptomsState extends State<quizpageSymptoms> {
child: Text( child: Text(
showtimer, showtimer,
style: TextStyle( style: TextStyle(
fontSize: 35.0, fontSize: 30.0,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
), ),
), ),
......
...@@ -144,8 +144,8 @@ class _symptomsQuizStartPageState extends State<symptomsQuizStartPage> { ...@@ -144,8 +144,8 @@ class _symptomsQuizStartPageState extends State<symptomsQuizStartPage> {
), ),
), ),
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
vertical: 20.0, vertical: 10.0,
horizontal: 200.0, horizontal: 50.0,
), ),
) )
], ],
......
...@@ -72,7 +72,7 @@ class _symptomsResultPageState extends State<symptomsResultPage> { ...@@ -72,7 +72,7 @@ class _symptomsResultPageState extends State<symptomsResultPage> {
child: Text( child: Text(
"You Scored $marks marks", "You Scored $marks marks",
style: TextStyle( style: TextStyle(
fontSize: 30.0, fontSize: 20.0,
fontWeight: FontWeight.w900, fontWeight: FontWeight.w900,
), ),
), ),
...@@ -98,8 +98,8 @@ class _symptomsResultPageState extends State<symptomsResultPage> { ...@@ -98,8 +98,8 @@ class _symptomsResultPageState extends State<symptomsResultPage> {
), ),
), ),
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
vertical: 20.0, vertical: 10.0,
horizontal: 200.0, horizontal: 50.0,
), ),
) )
], ],
......
import 'package:flutter/material.dart';
import 'dart:convert';
import 'finalOverallResultsPage.dart';
import 'levelsDashboard.dart';
import 'variables.dart';
import 'package:http/http.dart' as http;
class fResult extends StatefulWidget {
int marks;
fResult() : super();
@override
_fResultState createState() => _fResultState();
}
class _fResultState extends State<fResult> {
int marks;
int ima1 = 0;
int ima2 = 0;
int ima3 = 0;
int ima4 = 0;
int ima5 = 0;
String handWashingLevel = '';
String maskWearingLevel = '';
String socialDistanceLevel = '';
String publicPlacesLevel = '';
String symptomsLevel = '';
String handWashingLevelData = '';
String maskWearingLevelData = '';
String socialDistanceLevelData = '';
String publicPlacesLevelData = '';
String symptomsLevelData = '';
_fResultState();
@override
void initState() {
setLevel();
super.initState();
}
void setLevel() {
if ((marks1 >= 0 && (marks1 <= 24))) {
handWashingLevel = 'Very Low';
handWashingLevelData = '0';
ima1 = 100;
} else if ((marks1 >= 25 && (marks1 <= 48))) {
handWashingLevel = 'Low';
handWashingLevelData = '1';
ima1 = 200;
} else if ((marks1 >= 49 && (marks1 <= 72))) {
handWashingLevel = 'Moderate';
handWashingLevelData = '2';
ima1 = 300;
} else if ((marks1 >= 73 && (marks1 <= 96))) {
handWashingLevel = 'High';
handWashingLevelData = '3';
ima1 = 400;
} else if ((marks1 >= 97 && (marks1 <= 120))) {
handWashingLevel = 'Very High';
handWashingLevelData = '4';
ima1 = 500;
}
if ((marks2 >= 0 && (marks2 <= 32))) {
maskWearingLevel = 'Very Low';
maskWearingLevelData = '0';
ima2 = 100;
} else if ((marks2 >= 33 && (marks2 <= 64))) {
maskWearingLevel = 'Low';
maskWearingLevelData = '1';
ima2 = 200;
} else if ((marks2 >= 65 && (marks2 <= 96))) {
maskWearingLevel = 'Moderate';
maskWearingLevelData = '2';
ima2 = 300;
} else if ((marks2 >= 97 && (marks2 <= 128))) {
maskWearingLevel = 'High';
maskWearingLevelData = '3';
ima2 = 400;
} else if ((marks2 >= 129 && (marks2 <= 160))) {
maskWearingLevel = 'Very High';
maskWearingLevelData = '4';
ima2 = 500;
}
if ((marks3 >= 0 && (marks3 <= 32))) {
socialDistanceLevel = 'Very Low';
socialDistanceLevelData = '0';
ima3 = 100;
} else if ((marks3 >= 33 && (marks3 <= 64))) {
socialDistanceLevel = 'Low';
socialDistanceLevelData = '1';
ima3 = 200;
} else if ((marks3 >= 65 && (marks3 <= 96))) {
socialDistanceLevel = 'Moderate';
socialDistanceLevelData = '2';
ima3 = 300;
} else if ((marks3 >= 97 && (marks3 <= 128))) {
socialDistanceLevel = 'High';
socialDistanceLevelData = '3';
ima3 = 400;
} else if ((marks3 >= 129 && (marks3 <= 160))) {
socialDistanceLevel = 'Very High';
socialDistanceLevelData = '4';
ima3 = 500;
}
if ((marks4 >= 0 && (marks4 <= 16))) {
publicPlacesLevel = 'Very Low';
publicPlacesLevelData = '0';
ima4 = 100;
} else if ((marks4 >= 17 && (marks4 <= 32))) {
publicPlacesLevel = 'Low';
publicPlacesLevelData = '1';
ima4 = 200;
} else if ((marks4 >= 33 && (marks4 <= 48))) {
publicPlacesLevel = 'Moderate';
publicPlacesLevelData = '2';
ima4 = 300;
} else if ((marks4 >= 49 && (marks4 <= 64))) {
publicPlacesLevel = 'High';
publicPlacesLevelData = '3';
ima4 = 400;
} else if ((marks4 >= 65 && (marks4 <= 80))) {
publicPlacesLevel = 'Very High';
publicPlacesLevelData = '4';
ima4 = 500;
}
if ((marks5 >= 0 && (marks5 <= 8))) {
symptomsLevel = 'Very Low';
symptomsLevelData = '0';
ima5 = 100;
} else if ((marks5 >= 9 && (marks5 <= 16))) {
symptomsLevel = 'Low';
symptomsLevelData = '1';
ima5 = 200;
} else if ((marks5 >= 17 && (marks5 <= 24))) {
symptomsLevel = 'Moderate';
symptomsLevelData = '2';
ima5 = 300;
} else if ((marks5 >= 25 && (marks5 <= 32))) {
symptomsLevel = 'High';
symptomsLevelData = '3';
ima5 = 400;
} else if ((marks5 >= 33 && (marks5 <= 40))) {
symptomsLevel = 'Very High';
symptomsLevelData = '4';
ima5 = 500;
}
}
Future Getdata(url) async {
http.Response Response = await http.get(url);
return Response.body;
}
Future<void> check() async {
String urls =
'https://strackercovid.herokuapp.com/api/stracker?HandWashing=' +
handWashingLevelData.toString() +
'&MaskWearing=' +
maskWearingLevelData.toString() +
'&ScocialDistence=' +
socialDistanceLevelData.toString() +
'&BehaveInPublicPlaces=' +
publicPlacesLevelData.toString() +
'&Symptoms=' +
symptomsLevelData.toString();
var Data = await Getdata(urls);
var reText = jsonDecode(Data);
print(reText);
if (reText.toString() == '[0]') {
print("Very Low");
marks6 = 'Very Low';
} else if (reText.toString() == '[1]') {
print("Low");
marks6 = 'Low';
} else if (reText.toString() == '[2]') {
print("Moderate");
marks6 = 'Moderate';
} else if (reText.toString() == '[3]') {
print("High");
marks6 = 'High';
} else if (reText.toString() == '[4]') {
print("Very High");
marks6 = 'Very High';
}
}
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backwardsCompatibility: false,
title: Text("Final Result"),
),
body: Stack(
children: <Widget>[
Container(
decoration: BoxDecoration(
image: DecorationImage(
alignment: Alignment.topCenter,
image: AssetImage(
'lib/assets/images/topHeaderStracker.png',
),
))),
SafeArea(
child: Padding(
padding: EdgeInsets.all(16.0),
child: Column(
children: <Widget>[
Container(
height: 45,
margin: EdgeInsets.only(bottom: 20),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
CircleAvatar(
radius: 20,
backgroundColor: Colors.transparent,
backgroundImage:
AssetImage('lib/assets/images/stracker.PNG'),
),
SizedBox(
width: 16,
),
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text('STracker',
style: TextStyle(
fontSize: 30.0, color: Colors.white)),
],
)
],
),
),
Expanded(
flex: 10,
child: GridView.count(
mainAxisSpacing: 10,
crossAxisSpacing: 10,
primary: false,
crossAxisCount: 2,
children: <Widget>[
Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8)),
elevation: 10,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
FlatButton(
child: Image.asset(
"lib/assets/images/$ima1.png",
fit: BoxFit.contain,
width: 60,
height: 60,
),
),
Text(
"Hand Washing $marks1 / 120 \n \t \t \t \t \t $handWashingLevel",
style: TextStyle(
fontSize: 12.0,
fontWeight: FontWeight.w700,
)),
],
)),
Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8)),
elevation: 4,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
FlatButton(
child: Image.asset(
"lib/assets/images/$ima2.png",
fit: BoxFit.contain,
width: 60,
height: 60,
),
),
Text(
"Mask Wearing - $marks2 / 160 \n \t \t \t \t \t \t \t $maskWearingLevel",
style: TextStyle(
fontSize: 12.0,
fontWeight: FontWeight.w700,
))
],
)),
Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8)),
elevation: 4,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
FlatButton(
child: Image.asset(
"lib/assets/images/$ima3.png",
fit: BoxFit.contain,
width: 60,
height: 60,
),
),
Text(
"Distance - $marks3 / 160 \n \t \t \t $socialDistanceLevel",
style: TextStyle(
fontSize: 12.0,
fontWeight: FontWeight.w700,
))
],
)),
Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8)),
elevation: 4,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
FlatButton(
child: Image.asset(
"lib/assets/images/$ima4.png",
fit: BoxFit.contain,
width: 60,
height: 60,
),
),
Text(
"Public places - $marks4 / 80 \n \t \t \t \t \t $publicPlacesLevel",
style: TextStyle(
fontSize: 12.0,
fontWeight: FontWeight.w700,
))
],
)),
Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8)),
elevation: 4,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
FlatButton(
child: Image.asset(
"lib/assets/images/$ima5.png",
fit: BoxFit.contain,
width: 60,
height: 60,
),
),
Text(
"Symptoms - $marks5 / 40 \n \t \t \t $symptomsLevel",
style: TextStyle(
fontSize: 12.0,
fontWeight: FontWeight.w700,
))
],
)),
Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8)),
elevation: 4,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
FlatButton(
onPressed: () {
print("EEEE");
check();
Navigator.of(context)
.pushReplacement(MaterialPageRoute(
builder: (context) =>
finalOverallResultPage(),
));
},
child: Image.asset(
'lib/assets/images/result.png',
fit: BoxFit.contain,
width: 60,
height: 60,
),
),
Text(
"Overall Awareness \n \t \t \t \t \t \t Level",
style: TextStyle(
fontSize: 12.0,
fontWeight: FontWeight.w700))
],
)),
],
),
)
],
),
),
)
],
),
);
}
}
...@@ -13,8 +13,7 @@ class finalOverallResultPage extends StatefulWidget { ...@@ -13,8 +13,7 @@ class finalOverallResultPage extends StatefulWidget {
} }
class _finalOverallResultPageState extends State<finalOverallResultPage> { class _finalOverallResultPageState extends State<finalOverallResultPage> {
int ima = 100;
// int ima;
_finalOverallResultPageState(); _finalOverallResultPageState();
...@@ -27,25 +26,21 @@ class _finalOverallResultPageState extends State<finalOverallResultPage> { ...@@ -27,25 +26,21 @@ class _finalOverallResultPageState extends State<finalOverallResultPage> {
void setLevel() { void setLevel() {
print('marks6'); print('marks6');
print(marks6); print(marks6);
if(marks6 == 'Very Low'){ if (marks6 == 'Very Low') {
// ima = 100; ima = 100;
print('1'); print('1');
}else if(marks6 == 'Low'){ } else if (marks6 == 'Low') {
// ima = 200; ima = 200;
print('2'); print('2');
} else if (marks6 == 'Moderate') {
}else if(marks6 == 'Moderate'){ ima = 300;
// ima = 300;
print('3'); print('3');
} else if (marks6 == 'High') {
}else if(marks6 == 'High'){ ima = 400;
// ima = 400;
print('4'); print('4');
} else if (marks6 == 'Very High') {
}else if(marks6 == 'Very High'){ ima = 500;
// ima = 500;
print('5'); print('5');
} }
} }
...@@ -116,16 +111,16 @@ class _finalOverallResultPageState extends State<finalOverallResultPage> { ...@@ -116,16 +111,16 @@ class _finalOverallResultPageState extends State<finalOverallResultPage> {
body: Column( body: Column(
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
flex: 1, flex: 2,
child: ButtonTheme( child: ButtonTheme(
minWidth: 800.0, minWidth: 800.0,
height: 100.0, height: 200.0,
child: RaisedButton( child: RaisedButton(
color: Colors.redAccent, color: Colors.redAccent,
onPressed: () {}, onPressed: () {},
child: Text( child: Text(
"Overall Awareness Level", "Overall Awareness Level",
style: TextStyle(color: Colors.white, fontSize: 30), style: TextStyle(color: Colors.white, fontSize: 20),
), ),
), ),
)), )),
...@@ -169,7 +164,7 @@ class _finalOverallResultPageState extends State<finalOverallResultPage> { ...@@ -169,7 +164,7 @@ class _finalOverallResultPageState extends State<finalOverallResultPage> {
onPressed: () {}, onPressed: () {},
child: Text( child: Text(
"Your Awareness Level - $marks6", "Your Awareness Level - $marks6",
style: TextStyle(color: Colors.red, fontSize: 30), style: TextStyle(color: Colors.red, fontSize: 20),
), ),
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
vertical: 10.0, vertical: 10.0,
...@@ -189,7 +184,7 @@ class _finalOverallResultPageState extends State<finalOverallResultPage> { ...@@ -189,7 +184,7 @@ class _finalOverallResultPageState extends State<finalOverallResultPage> {
onPressed: () {}, onPressed: () {},
child: Image( child: Image(
image: AssetImage( image: AssetImage(
"lib/assets/images/100.png", "lib/assets/images/$ima.png",
), ),
), ),
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
...@@ -217,12 +212,12 @@ class _finalOverallResultPageState extends State<finalOverallResultPage> { ...@@ -217,12 +212,12 @@ class _finalOverallResultPageState extends State<finalOverallResultPage> {
child: Text( child: Text(
"Registration", "Registration",
style: TextStyle( style: TextStyle(
fontSize: 30.0, fontSize: 20.0,
), ),
), ),
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
vertical: 20.0, vertical: 10.0,
horizontal: 200.0, horizontal: 50.0,
), ),
) )
], ],
......
...@@ -154,38 +154,43 @@ class _finalResultState extends State<finalResult> { ...@@ -154,38 +154,43 @@ class _finalResultState extends State<finalResult> {
} }
} }
Future Getdata(url) async{ Future Getdata(url) async {
http.Response Response = await http.get(url); http.Response Response = await http.get(url);
return Response.body; return Response.body;
} }
Future<void> check() async{ Future<void> check() async {
String urls = 'https://strackercovid.herokuapp.com/api/stracker?HandWashing='+handWashingLevelData.toString()+'&MaskWearing='+maskWearingLevelData.toString()+'&ScocialDistence='+socialDistanceLevelData.toString()+'&BehaveInPublicPlaces='+publicPlacesLevelData.toString()+'&Symptoms='+symptomsLevelData.toString(); String urls =
'https://strackercovid.herokuapp.com/api/stracker?HandWashing=' +
handWashingLevelData.toString() +
'&MaskWearing=' +
maskWearingLevelData.toString() +
'&ScocialDistence=' +
socialDistanceLevelData.toString() +
'&BehaveInPublicPlaces=' +
publicPlacesLevelData.toString() +
'&Symptoms=' +
symptomsLevelData.toString();
var Data = await Getdata(urls); var Data = await Getdata(urls);
var reText = jsonDecode(Data); var reText = jsonDecode(Data);
print(reText); print(reText);
if(reText.toString() == '[0]') { if (reText.toString() == '[0]') {
print("Very Low"); print("Very Low");
marks6 = 'Very Low'; marks6 = 'Very Low';
} } else if (reText.toString() == '[1]') {
else if(reText.toString() == '[1]') {
print("Low"); print("Low");
marks6 = 'Low'; marks6 = 'Low';
} } else if (reText.toString() == '[2]') {
else if(reText.toString() == '[2]') {
print("Moderate"); print("Moderate");
marks6 = 'Moderate'; marks6 = 'Moderate';
} } else if (reText.toString() == '[3]') {
else if(reText.toString() == '[3]') {
print("High"); print("High");
marks6 = 'High'; marks6 = 'High';
} } else if (reText.toString() == '[4]') {
else if(reText.toString() == '[4]') {
print("Very High"); print("Very High");
marks6 = 'Very High'; marks6 = 'Very High';
} }
} }
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
......
...@@ -2,6 +2,7 @@ import 'package:covidefender/STracker/MaskWearing/maskWearingQuizStartPage.dart' ...@@ -2,6 +2,7 @@ import 'package:covidefender/STracker/MaskWearing/maskWearingQuizStartPage.dart'
import 'package:covidefender/STracker/PublicPlaces/publicPlacesQuizStartPage.dart'; import 'package:covidefender/STracker/PublicPlaces/publicPlacesQuizStartPage.dart';
import 'package:covidefender/STracker/SocialDistance/socialDistanceQuizStartPage.dart'; import 'package:covidefender/STracker/SocialDistance/socialDistanceQuizStartPage.dart';
import 'package:covidefender/STracker/Symptoms/symptomsQuizStartPage.dart'; import 'package:covidefender/STracker/Symptoms/symptomsQuizStartPage.dart';
import 'package:covidefender/STracker/fResult.dart';
import 'package:covidefender/STracker/finalResult.dart'; import 'package:covidefender/STracker/finalResult.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
...@@ -36,13 +37,13 @@ class _levelsDashboardState extends State<levelsDashboard> { ...@@ -36,13 +37,13 @@ class _levelsDashboardState extends State<levelsDashboard> {
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
Container( Container(
height: 64, height: 45,
margin: EdgeInsets.only(bottom: 20), margin: EdgeInsets.only(bottom: 20),
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
CircleAvatar( CircleAvatar(
radius: 32, radius: 20,
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
backgroundImage: backgroundImage:
AssetImage('lib/assets/images/stracker.PNG'), AssetImage('lib/assets/images/stracker.PNG'),
...@@ -56,13 +57,14 @@ class _levelsDashboardState extends State<levelsDashboard> { ...@@ -56,13 +57,14 @@ class _levelsDashboardState extends State<levelsDashboard> {
children: <Widget>[ children: <Widget>[
Text('STracker', Text('STracker',
style: TextStyle( style: TextStyle(
fontSize: 35.0, color: Colors.white)), fontSize: 30.0, color: Colors.white)),
], ],
) )
], ],
), ),
), ),
Expanded( Expanded(
flex: 10,
child: GridView.count( child: GridView.count(
mainAxisSpacing: 10, mainAxisSpacing: 10,
crossAxisSpacing: 10, crossAxisSpacing: 10,
...@@ -87,13 +89,13 @@ class _levelsDashboardState extends State<levelsDashboard> { ...@@ -87,13 +89,13 @@ class _levelsDashboardState extends State<levelsDashboard> {
child: Image.asset( child: Image.asset(
'lib/assets/images/handWashing.png', 'lib/assets/images/handWashing.png',
fit: BoxFit.contain, fit: BoxFit.contain,
width: 200, width: 100,
height: 200, height: 100,
), ),
), ),
Text('Hand Washing', Text('Hand Washing',
style: TextStyle( style: TextStyle(
fontSize: 30.0, fontSize: 20.0,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
)), )),
], ],
...@@ -117,13 +119,13 @@ class _levelsDashboardState extends State<levelsDashboard> { ...@@ -117,13 +119,13 @@ class _levelsDashboardState extends State<levelsDashboard> {
child: Image.asset( child: Image.asset(
'lib/assets/images/maskWearing.png', 'lib/assets/images/maskWearing.png',
fit: BoxFit.contain, fit: BoxFit.contain,
width: 200, width: 100,
height: 200, height: 100,
), ),
), ),
Text('Mask Wearing', Text('Mask Wearing',
style: TextStyle( style: TextStyle(
fontSize: 30.0, fontSize: 20.0,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
)) ))
], ],
...@@ -147,13 +149,13 @@ class _levelsDashboardState extends State<levelsDashboard> { ...@@ -147,13 +149,13 @@ class _levelsDashboardState extends State<levelsDashboard> {
child: Image.asset( child: Image.asset(
'lib/assets/images/socialDistance.png', 'lib/assets/images/socialDistance.png',
fit: BoxFit.contain, fit: BoxFit.contain,
width: 200, width: 100,
height: 200, height: 100,
), ),
), ),
Text('Socila Distance', Text('Distance',
style: TextStyle( style: TextStyle(
fontSize: 30.0, fontSize: 20.0,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
)) ))
], ],
...@@ -177,13 +179,13 @@ class _levelsDashboardState extends State<levelsDashboard> { ...@@ -177,13 +179,13 @@ class _levelsDashboardState extends State<levelsDashboard> {
child: Image.asset( child: Image.asset(
'lib/assets/images/publicPlaces.png', 'lib/assets/images/publicPlaces.png',
fit: BoxFit.contain, fit: BoxFit.contain,
width: 200, width: 100,
height: 200, height: 100,
), ),
), ),
Text('Public Places', Text('Public Places',
style: TextStyle( style: TextStyle(
fontSize: 30.0, fontSize: 20.0,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
)) ))
], ],
...@@ -207,13 +209,13 @@ class _levelsDashboardState extends State<levelsDashboard> { ...@@ -207,13 +209,13 @@ class _levelsDashboardState extends State<levelsDashboard> {
child: Image.asset( child: Image.asset(
'lib/assets/images/symptoms.png', 'lib/assets/images/symptoms.png',
fit: BoxFit.contain, fit: BoxFit.contain,
width: 200, width: 100,
height: 200, height: 100,
), ),
), ),
Text('Symptoms', Text('Symptoms',
style: TextStyle( style: TextStyle(
fontSize: 30.0, fontSize: 20.0,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
)) ))
], ],
...@@ -230,19 +232,19 @@ class _levelsDashboardState extends State<levelsDashboard> { ...@@ -230,19 +232,19 @@ class _levelsDashboardState extends State<levelsDashboard> {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => finalResult()), builder: (context) => fResult()),
); );
}, },
child: Image.asset( child: Image.asset(
'lib/assets/images/result.png', 'lib/assets/images/result.png',
fit: BoxFit.contain, fit: BoxFit.contain,
width: 200, width: 100,
height: 200, height: 100,
), ),
), ),
Text('Final Result', Text('Final Result',
style: TextStyle( style: TextStyle(
fontSize: 30.0, fontSize: 20.0,
fontWeight: FontWeight.w700)) fontWeight: FontWeight.w700))
], ],
)), )),
......
...@@ -63,7 +63,7 @@ class _strackerDasboardState extends State<strackerDasboard> { ...@@ -63,7 +63,7 @@ class _strackerDasboardState extends State<strackerDasboard> {
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[ children: <Widget>[
CircleAvatar( CircleAvatar(
radius: 100, radius: 50,
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
backgroundImage: backgroundImage:
AssetImage('lib/assets/images/stracker.PNG'), AssetImage('lib/assets/images/stracker.PNG'),
...@@ -98,13 +98,13 @@ class _strackerDasboardState extends State<strackerDasboard> { ...@@ -98,13 +98,13 @@ class _strackerDasboardState extends State<strackerDasboard> {
child: Image.asset( child: Image.asset(
'lib/assets/images/play.png', 'lib/assets/images/play.png',
fit: BoxFit.contain, fit: BoxFit.contain,
width: 200, width: 100,
height: 200, height: 100,
), ),
), ),
Text('Play', Text('Play',
style: TextStyle( style: TextStyle(
fontSize: 30.0, fontSize: 20.0,
fontWeight: FontWeight.w700)), fontWeight: FontWeight.w700)),
], ],
)), )),
...@@ -125,13 +125,13 @@ class _strackerDasboardState extends State<strackerDasboard> { ...@@ -125,13 +125,13 @@ class _strackerDasboardState extends State<strackerDasboard> {
child: Image.asset( child: Image.asset(
'lib/assets/images/instructions.png', 'lib/assets/images/instructions.png',
fit: BoxFit.contain, fit: BoxFit.contain,
width: 200, width: 100,
height: 200, height: 100,
), ),
), ),
Text('Instructions', Text('Instructions',
style: TextStyle( style: TextStyle(
fontSize: 30.0, fontSize: 20.0,
fontWeight: FontWeight.w700)) fontWeight: FontWeight.w700))
], ],
)), )),
...@@ -152,13 +152,13 @@ class _strackerDasboardState extends State<strackerDasboard> { ...@@ -152,13 +152,13 @@ class _strackerDasboardState extends State<strackerDasboard> {
child: Image.asset( child: Image.asset(
'lib/assets/images/score.png', 'lib/assets/images/score.png',
fit: BoxFit.contain, fit: BoxFit.contain,
width: 200, width: 100,
height: 200, height: 100,
), ),
), ),
Text('Score Board', Text('Score Board',
style: TextStyle( style: TextStyle(
fontSize: 30.0, fontSize: 20.0,
fontWeight: FontWeight.w700)) fontWeight: FontWeight.w700))
], ],
)), )),
...@@ -179,13 +179,13 @@ class _strackerDasboardState extends State<strackerDasboard> { ...@@ -179,13 +179,13 @@ class _strackerDasboardState extends State<strackerDasboard> {
child: Image.asset( child: Image.asset(
'lib/assets/images/awrenessLevel.png', 'lib/assets/images/awrenessLevel.png',
fit: BoxFit.contain, fit: BoxFit.contain,
width: 200, width: 100,
height: 200, height: 100,
), ),
), ),
Text('Awreness Level', Text('Awareness ',
style: TextStyle( style: TextStyle(
fontSize: 30.0, fontSize: 20.0,
fontWeight: FontWeight.w700)) fontWeight: FontWeight.w700))
], ],
)), )),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment