Commit 7a717f26 authored by indika N kumara's avatar indika N kumara

Merge branch 'mix_Eanalyzer_and_Iguider_phase02' into 'I_GUIDER_PHASE_02_NK'

# Conflicts:
#   pubspec.yaml
parents 6d3a8008 e3e5cab2
{
"ExpandedNodes": [
""
],
"PreviewInSolutionExplorer": false
}
\ No newline at end of file
File added
......@@ -38,7 +38,7 @@ getDate(date){
getTime(time){
this.time= time;
}
//---------------------------------------------Create Data-----------------------------------------------------
createData(){
print("object");
......@@ -59,6 +59,52 @@ createData(){
}
//---------------------------------------------Read Data-----------------------------------------------------
readData(){
DocumentReference documentReference = Firestore.instance.collection("RiskLocation").document(userName);
documentReference.get().then((datasnapshot){
print(datasnapshot.data()["userName"]);
print(datasnapshot.data()["phoneNumber"]);
print(datasnapshot.data()["riskLocation"]);
print(datasnapshot.data()["hotelName"]);
print(datasnapshot.data()["date"]);
print(datasnapshot.data()["time"]);
});
}
//---------------------------------------------Update Data-----------------------------------------------------
updateData(){
print("object");
DocumentReference documentReference = Firestore.instance.collection("RiskLocation").document(userName);
Map<String, dynamic> locations ={
"userName": userName,
"phoneNumber": phoneNumber,
"riskLocation": riskLocation,
"hotelName": hotelName,
"date": date,
"time": time
};
documentReference.setData(locations).whenComplete(() {
print("$userName Updated");
});
}
//---------------------------------------------Delete Data-----------------------------------------------------
deleteData(){
DocumentReference documentReference = Firestore.instance.collection("RiskLocation").document(userName);
documentReference.delete().whenComplete((){
print("$userName Deleted");
});
}
final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
//---------------------------------------------User Name-----------------------------------------------------
Widget _buildName(){
......@@ -82,6 +128,8 @@ Widget _buildName(){
Widget _buildPNo(){
return TextFormField(
decoration: InputDecoration(labelText: 'Phone Number'),
keyboardType: TextInputType.phone,
maxLength: 10,
validator: (String value){
if (value.isEmpty) {
return '*Phone Number is Required';
......@@ -154,8 +202,6 @@ Widget _buildDate(){
Widget _buildTime(){
return TextFormField(
decoration: InputDecoration(labelText: 'Time'),
keyboardType: TextInputType.phone,
maxLength: 10,
validator: (String value){
if (value.isEmpty) {
return '*Time is Required';
......@@ -183,8 +229,9 @@ Widget _buildTime(){
margin: EdgeInsets.all(24),
child: Form(
key: _formKey,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
child: ListView(
scrollDirection: Axis.vertical,
//mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
_buildName(),
_buildPNo(),
......@@ -196,32 +243,63 @@ Widget _buildTime(){
SizedBox(height: 100),
RaisedButton(
color: Colors.green,
child: Text(
'Submit',
style: TextStyle(color: Colors.green, fontSize: 18),
style: TextStyle(color: Colors.white, fontSize: 18),
),
onPressed: () {
if(!_formKey.currentState.validate()) {
return;
}
// _formKey.currentState.save();
createData();
// print(_fName);
// print(_lName);
// print(_age);
// print(_address);
// print(_nic);
// print(_phoneNumber);
// print(_riskLocation);
// print(_hotelName);
// print(_date);
// print(_time);
} ,
),
createData();
// RaisedButton(
// color: Colors.blue,
// child: Text(
// 'View',
// style: TextStyle(color: Colors.white, fontSize: 18),
// ),
// onPressed: () {
// readData();
// } ,
// ),
RaisedButton(
color: Colors.yellowAccent[700],
child: Text(
'Update',
style: TextStyle(color: Colors.white, fontSize: 18),
),
onPressed: () {
updateData();
} ,
)
),
RaisedButton(
color: Colors.red,
child: Text(
'Delete',
style: TextStyle(color: Colors.white, fontSize: 18),
),
onPressed: () {
deleteData();
} ,
),
],
),),
......
import 'package:covidefender/EAnalyzer/HospitalDetails.dart';
import 'package:covidefender/EAnalyzer/SearchEvent.dart';
import 'package:flutter/material.dart';
import 'AddLocation.dart';
......@@ -125,7 +127,7 @@ class EAnalyzerDash extends StatelessWidget {
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => EAnalyzerDash()),
MaterialPageRoute(builder: (context) => SearchEvent()),
);
},
child: Image.asset('lib/assets/images/search80.png'),
......@@ -134,6 +136,26 @@ class EAnalyzerDash extends StatelessWidget {
],
)
),
Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8)),
elevation: 4,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
FlatButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => HospitalDetails()),
);
},
child: Image.asset('lib/assets/images/search80.png'),
),
Text('Search Hospitals', style: TextStyle(fontSize: 20.0))
],
)
),
],
),
)
......
import 'package:covidefender/EAnalyzer/AddLocation.dart';
import 'package:flutter/material.dart';
import 'dart:async';
import 'dart:convert';
import 'package:http/http.dart' as http;
class HospitalDetails extends StatefulWidget {
HospitalDetails({Key key,this.title}) :super(key: key);
final String title;
@override
_HospitalDetailsState createState() => _HospitalDetailsState();
}
class _HospitalDetailsState extends State<HospitalDetails> {
//---------------------------------------------------------------------------------------------------------------------------------------
// Future<List<Hospital>> _getHospitals() async{
// var data = await http.get("https://www.hpb.health.gov.lk/api/get-current-statistical");
// var jsonData = json.decode(data.body);
// List<Hospital> hospitals = [];
// for(var hospital in jsonData["data"]){
// Hospital newHospital =Hospital(hospital["update_date_time"],hospital["local_new_cases"]);
// //, hospital["cumulative_local"], hospital["cumulative_foreign"], hospital["created_at"]
// hospitals.add(newHospital);
// }
// return hospitals;
// }
//---------------------------------------------------------------------------------------------------------------------------------------
Map data;
List userData;
Future getData() async{
http.Response response = await http.get("https://www.hpb.health.gov.lk/api/get-current-statistical");
data = json.decode(response.body);
setState(() {
userData = data["data"]["hospital_data"];
});
debugPrint(userData.toString());
}
@override
void initState() {
super.initState();
getData();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backwardsCompatibility: false,
backgroundColor: Color(0xFF1B5E20),
title: Text("Search Hospitals COVID-19 Details"),
),
body: ListView.builder(
itemCount: userData == null ? 0 : userData.length,
itemBuilder: (BuildContext context, int index) {
return Card(
elevation: 8,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20.0),
),
color: Colors.lightGreen[50],
child: Padding(
padding: const EdgeInsets.all(12.0),
child: Row(
children: <Widget>[
Padding(
padding: const EdgeInsets.all(12.0),
child: Text("Hospital ID: ${userData[index]["hospital_id"]}\n${userData[index]["hospital"]["name"]}\n${userData[index]["hospital"]["name_si"]}\n\nTotal Patients: ${userData[index]["cumulative_total"]}\nDate/Time: ${userData[index]["created_at"]}",
style: TextStyle(
fontSize: 18.0,
fontWeight: FontWeight.w700,
),),
),
// Text("\n\n\n\n\n\n\n\n\n${userData[index]["created_at"]}"),
// Text("${userData[index]["email"]}"),
],
),
),
);
},
),
//-----------------------------------------------------------------------------------------------------------------------------------------
// body: Container(
// child: FutureBuilder(
// //future: _getHospitals(),
// builder: (BuildContext context, AsyncSnapshot snapshot){
// if (snapshot.data == null) {
// return Container(
// child: Center(
// child: Text("No data....."),
// ),
// );
// }else{
// return ListView.builder(
// itemCount: snapshot.data.lenght,
// itemBuilder: (BuildContext context, int index){
// return ListTile(
// title: Text(snapshot.data[index].updateDateTime),
// subtitle: Text(snapshot.data[index].localNewCases),
// );
// },
// );
// }
// },
// ),
// ),
//---------------------------------------------------------------------------------------------------------------------------------------
);
}
}
//-----------------------------------------Class Hospital--------------------------------------------------
// class Hospital{
// final String date;
// final String count;
// final String hospitalId;
// final String hospital;
// final String cumulativeLocal;
// final String cumulativeForeign;
// final String createdAt;
//Hospital(this.hospitalId,this.hospital,this.cumulativeLocal,this.cumulativeForeign,this.createdAt);
// Hospital(this.date,this.count);
// }
\ No newline at end of file
......@@ -21,13 +21,13 @@ class _LoadingScreenState extends State<LoadingScreen> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.green.shade300,
backgroundColor: Colors.lightGreen[400],
body: Stack(
children: <Widget>[
Container(
decoration: BoxDecoration(
image: DecorationImage(
alignment: Alignment.topCenter,
alignment: Alignment.center,
image: AssetImage('lib/assets/images/eana.png'),
))),
]
......
import 'package:flutter/material.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart';
class SearchEvent extends StatefulWidget {
const SearchEvent({ Key key }) : super(key: key);
@override
_SearchEventState createState() => _SearchEventState();
}
class _SearchEventState extends State<SearchEvent> {
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: AppBar(
backwardsCompatibility: false,
backgroundColor: Color(0xFF1B5E20),
title: Text("Search an Event"),
),
body: ListPage(),
);
}
}
class ListPage extends StatefulWidget {
@override
_ListPageState createState() => _ListPageState();
}
class _ListPageState extends State<ListPage> {
Future _data;
Future getRiskLocation() async {
var firestore = Firestore.instance;
QuerySnapshot qn = await firestore.collection("RiskLocation").getDocuments();
return qn.documents;
}
navigateToDetail(DocumentSnapshot riskLocation){
Navigator.push(context, MaterialPageRoute(builder: (context) => DetailPage(riskLocation: riskLocation,)));
}
@override
void initState() {
// TODO: implement initState
super.initState();
_data = getRiskLocation();
}
@override
Widget build(BuildContext context) {
return Container(
child: FutureBuilder(
future: _data,
// ignore: missing_return
builder:(_, snapshot){
if (snapshot.connectionState == ConnectionState.waiting) {
return Center(
child: SpinKitFadingCircle(
color: Colors.green,
size: 80.0,
),
);
}else{
return ListView.builder(
itemCount: snapshot.data.length,
itemBuilder: (_, index){
return Card(
elevation: 8,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15.0),
),
color: Colors.lightGreen[100],
child: ListTile(
leading: Icon(Icons.location_city, size: 40),
title: Text(snapshot.data[index].data()["hotelName"],style: TextStyle(fontSize: 20.0,fontWeight: FontWeight.bold),),
subtitle: Text(snapshot.data[index].data()["riskLocation"],style: TextStyle(fontSize: 16.0),),
onTap: () => navigateToDetail(snapshot.data[index]),
),
);
});
}
} ),
);
}
}
class DetailPage extends StatefulWidget {
final DocumentSnapshot riskLocation;
DetailPage({this.riskLocation});
@override
_DetailPageState createState() => _DetailPageState();
}
class _DetailPageState extends State<DetailPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backwardsCompatibility: false,
backgroundColor: Color(0xFF1B5E20),
title: Text(widget.riskLocation.data()["hotelName"]),
),
body: Container(
width: 410,
height: 100,
child: Card(
elevation: 8,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20.0),
),
color: Colors.lightGreen[50],
child: ListTile(
leading: Icon(Icons.timelapse, size: 40),
title: Text("Date : ${widget.riskLocation.data()["date"]}" ,style: TextStyle(fontSize: 20.0,fontWeight: FontWeight.bold),),
subtitle: Text("Time : ${widget.riskLocation.data()["time"]}",style: TextStyle(fontSize: 20.0,fontWeight: FontWeight.bold),),
),
),
),
);
}
}
import 'package:covidefender/STracker/quizpage.dart';
import 'package:covidefender/STracker/HandWashing/quizpage.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
......
import 'dart:async';
import 'dart:convert';
import 'package:covidefender/STracker/resultpage.dart';
import 'package:covidefender/STracker/HandWashing/resultpage.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
......@@ -49,8 +49,10 @@ class _quizpageState extends State<quizpage> {
int marks = 0;
int i = 1;
int x = 0;
int timer = 60;
String showtimer = "60";
int hangState = 0;
Map<String, Color> btncolor = {
"a": Colors.indigoAccent,
......@@ -109,6 +111,8 @@ class _quizpageState extends State<quizpage> {
colortoshow = right;
} else {
colortoshow = wrong;
x = x + 1;
showHangman(x);
}
setState(() {
btncolor[k] = colortoshow;
......@@ -118,6 +122,20 @@ class _quizpageState extends State<quizpage> {
Timer(Duration(seconds: 2), nextquestion);
}
void showHangman(x) {
if (x == 1) {
hangState = 1;
} else if (x == 2) {
hangState = 2;
} else if (x == 3) {
hangState = 3;
} else if (x == 4) {
hangState = 4;
} else {
hangState = 5;
}
}
Widget choicebutton(String k) {
return Padding(
padding: EdgeInsets.symmetric(
......@@ -173,6 +191,31 @@ class _quizpageState extends State<quizpage> {
child: Scaffold(
body: Column(
children: <Widget>[
Expanded(
flex: 5,
child: Material(
elevation: 20.0,
child: Container(
width: 200.0,
height: 150.0,
child: Column(
children: <Widget>[
Material(
child: Container(
width: 200.0,
height: 200.0,
child: ClipRRect(
child: Image(
image: AssetImage(
"lib/assets/images/$hangState.png"),
),
),
),
),
],
)),
),
),
Expanded(
flex: 2,
child: Container(
......
import 'package:covidefender/STracker/HandWashing/quizpage.dart';
import 'package:flutter/material.dart';
import 'levelsDashboard.dart';
import '../levelsDashboard.dart';
import '../variables.dart';
class resultpage extends StatefulWidget {
int marks;
......@@ -12,7 +14,17 @@ class resultpage extends StatefulWidget {
class _resultpageState extends State<resultpage> {
int marks;
_resultpageState(this.marks);
@override
void initState() {
testMethod();
super.initState();
}
void testMethod() {
marks1 = this.marks;
}
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
......
import 'dart:async';
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'maskWearingResultPage.dart';
class getjsonMaskWearing extends StatelessWidget {
@override
Widget build(BuildContext context) {
return FutureBuilder(
future: DefaultAssetBundle.of(context)
.loadString("lib/assets/pythonMaskWearing.json"),
builder: (context, snapshot) {
List mydata = json.decode(snapshot.data.toString());
if (mydata == null) {
return Scaffold(
body: Center(
child: Text(
"Loading",
),
),
);
// return quizpage();
} else {
return quizpageMaskWearing(mydata: mydata);
}
});
}
}
class quizpageMaskWearing extends StatefulWidget {
var mydata;
quizpageMaskWearing({Key key, @required this.mydata}) : super(key: key);
@override
_quizpageMaskWearingState createState() => _quizpageMaskWearingState(mydata);
}
class _quizpageMaskWearingState extends State<quizpageMaskWearing> {
var mydata;
_quizpageMaskWearingState(this.mydata);
Color colortoshow = Colors.indigoAccent;
Color right = Colors.green;
Color wrong = Colors.red;
int marks = 0;
int i = 1;
int x = 0;
int timer = 60;
String showtimer = "60";
int hangState = 0;
Map<String, Color> btncolor = {
"a": Colors.indigoAccent,
"b": Colors.indigoAccent,
"c": Colors.indigoAccent,
"d": Colors.indigoAccent
};
bool canceltimer = false;
@override
void initState() {
starttimer();
super.initState();
}
void starttimer() async {
const onesec = Duration(seconds: 1);
Timer.periodic(onesec, (Timer t) {
setState(() {
if (timer < 1) {
t.cancel();
nextquestion();
} else if (canceltimer == true) {
t.cancel();
} else {
timer = timer - 1;
}
showtimer = timer.toString();
});
});
}
void nextquestion() {
canceltimer = false;
timer = 60;
setState(() {
if (i < 5) {
i++;
} else {
Navigator.of(context).pushReplacement(MaterialPageRoute(
builder: (context) => maskWearingResultPage(marks: marks),
));
}
btncolor["a"] = Colors.indigoAccent;
btncolor["b"] = Colors.indigoAccent;
btncolor["c"] = Colors.indigoAccent;
btncolor["d"] = Colors.indigoAccent;
});
starttimer();
}
void checkanswer(String k) {
if (mydata[2][i.toString()] == mydata[1][i.toString()][k]) {
marks = marks + 5;
colortoshow = right;
} else {
colortoshow = wrong;
x = x + 1;
showHangman(x);
}
setState(() {
btncolor[k] = colortoshow;
canceltimer = true;
});
Timer(Duration(seconds: 2), nextquestion);
}
void showHangman(x) {
if (x == 1) {
hangState = 1;
} else if (x == 2) {
hangState = 2;
} else if (x == 3) {
hangState = 3;
} else if (x == 4) {
hangState = 4;
} else {
hangState = 5;
}
}
Widget choicebutton(String k) {
return Padding(
padding: EdgeInsets.symmetric(
vertical: 10.0,
horizontal: 20.0,
),
child: MaterialButton(
onPressed: () => checkanswer(k),
child: Text(
mydata[1][i.toString()][k],
style: TextStyle(
color: Colors.white,
fontSize: 16.0,
),
maxLines: 1,
),
color: btncolor[k],
splashColor: Colors.indigo[700],
highlightColor: Colors.indigo[700],
minWidth: 200.0,
height: 45.0,
shape:
RoundedRectangleBorder(borderRadius: BorderRadius.circular(20.0)),
),
);
}
@override
Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations(
[DeviceOrientation.portraitDown, DeviceOrientation.portraitUp]);
return WillPopScope(
onWillPop: () {
return showDialog(
context: context,
builder: (context) => AlertDialog(
title: Text(
"QuizStar - Warning",
),
content: Text("You can't go back at this stage"),
actions: <Widget>[
FlatButton(
onPressed: () {
Navigator.of(context).pop();
},
child: Text(
'OK',
),
)
],
));
},
child: Scaffold(
body: Column(
children: <Widget>[
Expanded(
flex: 5,
child: Material(
elevation: 20.0,
child: Container(
width: 200.0,
height: 150.0,
child: Column(
children: <Widget>[
Material(
child: Container(
width: 200.0,
height: 200.0,
child: ClipRRect(
child: Image(
image: AssetImage(
"lib/assets/images/$hangState.png"),
),
),
),
),
],
)),
),
),
Expanded(
flex: 2,
child: Container(
padding: EdgeInsets.all(15.0),
alignment: Alignment.bottomLeft,
child: Text(
mydata[0][i.toString()],
style: TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.w700,
),
),
decoration: BoxDecoration(
color: Colors.blueAccent,
),
),
),
Expanded(
flex: 6,
child: Container(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
choicebutton('a'),
choicebutton('b'),
choicebutton('c'),
choicebutton('d'),
],
),
),
),
Expanded(
flex: 1,
child: Container(
alignment: Alignment.topCenter,
child: Center(
child: Text(
showtimer,
style: TextStyle(
fontSize: 35.0,
fontWeight: FontWeight.w700,
),
),
),
decoration: BoxDecoration(
color: Colors.red,
),
),
),
],
),
),
);
}
}
import 'package:covidefender/STracker/MaskWearing/maskWearingQuizPage.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
class maskWearingQuizStartPage extends StatefulWidget {
@override
_maskWearingQuizStartPageState createState() => _maskWearingQuizStartPageState();
}
class _maskWearingQuizStartPageState extends State<maskWearingQuizStartPage> {
List<String> images = [
"lib/assets/images/startQuiz.png",
];
Widget customcard(String type, String image) {
return Padding(
padding: EdgeInsets.all(
20.0,
),
child: InkWell(
onTap: () {
Navigator.of(context).pushReplacement(MaterialPageRoute(
builder: (context) => getjsonMaskWearing(),
));
},
child: Material(
color: Colors.indigoAccent,
elevation: 10.0,
borderRadius: BorderRadius.circular(20.0),
child: Container(
child: Column(
children: <Widget>[
Padding(
padding: EdgeInsets.symmetric(
vertical: 10.0,
),
child: Material(
elevation: 5.0,
borderRadius: BorderRadius.circular(100.0),
child: Container(
height: 100.0,
width: 100.0,
child: ClipOval(
child: Image(
fit: BoxFit.contain,
image: AssetImage(
image,
),
),
),
),
),
),
Center(
child: Text(
type,
style: TextStyle(
fontSize: 24.0,
fontWeight: FontWeight.w700,
),
),
),
],
),
),
),
),
);
}
@override
Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations(
[DeviceOrientation.portraitDown, DeviceOrientation.portraitUp]);
return Scaffold(
appBar: AppBar(
title: Text("STracker"),
),
body: ListView(
children: <Widget>[
customcard("Start Quiz", images[0]),
],
),
);
}
}
import 'package:flutter/material.dart';
import '../levelsDashboard.dart';
import '../variables.dart';
class maskWearingResultPage extends StatefulWidget {
int marks;
maskWearingResultPage({Key key, @required this.marks}) : super(key: key);
@override
_maskWearingResultPageState createState() =>
_maskWearingResultPageState(marks);
}
class _maskWearingResultPageState extends State<maskWearingResultPage> {
int marks;
_maskWearingResultPageState(this.marks);
@override
void initState() {
testMethod();
super.initState();
}
void testMethod() {
marks2 = this.marks;
}
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(
"Result for Mask Wearing",
),
),
body: Column(
children: <Widget>[
Expanded(
flex: 7,
child: Material(
elevation: 10.0,
child: Container(
width: 300.0,
height: 300.0,
child: Column(
children: <Widget>[
Material(
child: Container(
width: 300.0,
height: 300.0,
child: ClipRRect(
child: Image(
image:
AssetImage("lib/assets/images/gameover.jpg"),
),
),
),
),
Padding(
padding: EdgeInsets.symmetric(
vertical: 5.0,
horizontal: 15.0,
),
child: Center(
child: Text(
"You Scored $marks marks",
style: TextStyle(
fontSize: 20.0,
fontWeight: FontWeight.w700,
),
),
)),
],
)),
),
),
Expanded(
flex: 4,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
OutlineButton(
onPressed: () {
Navigator.of(context).pushReplacement(MaterialPageRoute(
builder: (context) => levelsDashboard(),
));
},
child: Text(
"Continue",
style: TextStyle(
fontSize: 18.0,
),
),
padding: EdgeInsets.symmetric(
vertical: 10.0,
horizontal: 25.0,
),
borderSide: BorderSide(width: 3.0, color: Colors.indigo),
splashColor: Colors.indigoAccent,
)
],
),
)
],
),
);
}
}
import 'dart:async';
import 'dart:convert';
import 'package:covidefender/STracker/PublicPlaces/publicPlacesResultPage.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
class getjsonPublicPlaces extends StatelessWidget {
@override
Widget build(BuildContext context) {
return FutureBuilder(
future: DefaultAssetBundle.of(context)
.loadString("lib/assets/pythonPublicPlaces.json"),
builder: (context, snapshot) {
List mydata = json.decode(snapshot.data.toString());
if (mydata == null) {
return Scaffold(
body: Center(
child: Text(
"Loading",
),
),
);
// return quizpage();
} else {
return quizpagePublicPlaces(mydata: mydata);
}
});
}
}
class quizpagePublicPlaces extends StatefulWidget {
var mydata;
quizpagePublicPlaces({Key key, @required this.mydata}) : super(key: key);
@override
_quizpagePublicPlacesState createState() => _quizpagePublicPlacesState(mydata);
}
class _quizpagePublicPlacesState extends State<quizpagePublicPlaces> {
var mydata;
_quizpagePublicPlacesState(this.mydata);
Color colortoshow = Colors.indigoAccent;
Color right = Colors.green;
Color wrong = Colors.red;
int marks = 0;
int i = 1;
int x = 0;
int timer = 60;
String showtimer = "60";
int hangState = 0;
Map<String, Color> btncolor = {
"a": Colors.indigoAccent,
"b": Colors.indigoAccent,
"c": Colors.indigoAccent,
"d": Colors.indigoAccent
};
bool canceltimer = false;
@override
void initState() {
starttimer();
super.initState();
}
void starttimer() async {
const onesec = Duration(seconds: 1);
Timer.periodic(onesec, (Timer t) {
setState(() {
if (timer < 1) {
t.cancel();
nextquestion();
} else if (canceltimer == true) {
t.cancel();
} else {
timer = timer - 1;
}
showtimer = timer.toString();
});
});
}
void nextquestion() {
canceltimer = false;
timer = 60;
setState(() {
if (i < 5) {
i++;
} else {
Navigator.of(context).pushReplacement(MaterialPageRoute(
builder: (context) => publicPlacesResultPage(marks: marks),
));
}
btncolor["a"] = Colors.indigoAccent;
btncolor["b"] = Colors.indigoAccent;
btncolor["c"] = Colors.indigoAccent;
btncolor["d"] = Colors.indigoAccent;
});
starttimer();
}
void checkanswer(String k) {
if (mydata[2][i.toString()] == mydata[1][i.toString()][k]) {
marks = marks + 5;
colortoshow = right;
} else {
colortoshow = wrong;
x = x + 1;
showHangman(x);
}
setState(() {
btncolor[k] = colortoshow;
canceltimer = true;
});
Timer(Duration(seconds: 2), nextquestion);
}
void showHangman(x) {
if (x == 1) {
hangState = 1;
} else if (x == 2) {
hangState = 2;
} else if (x == 3) {
hangState = 3;
} else if (x == 4) {
hangState = 4;
} else {
hangState = 5;
}
}
Widget choicebutton(String k) {
return Padding(
padding: EdgeInsets.symmetric(
vertical: 10.0,
horizontal: 20.0,
),
child: MaterialButton(
onPressed: () => checkanswer(k),
child: Text(
mydata[1][i.toString()][k],
style: TextStyle(
color: Colors.white,
fontSize: 16.0,
),
maxLines: 1,
),
color: btncolor[k],
splashColor: Colors.indigo[700],
highlightColor: Colors.indigo[700],
minWidth: 200.0,
height: 45.0,
shape:
RoundedRectangleBorder(borderRadius: BorderRadius.circular(20.0)),
),
);
}
@override
Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations(
[DeviceOrientation.portraitDown, DeviceOrientation.portraitUp]);
return WillPopScope(
onWillPop: () {
return showDialog(
context: context,
builder: (context) => AlertDialog(
title: Text(
"QuizStar - Warning",
),
content: Text("You can't go back at this stage"),
actions: <Widget>[
FlatButton(
onPressed: () {
Navigator.of(context).pop();
},
child: Text(
'OK',
),
)
],
));
},
child: Scaffold(
body: Column(
children: <Widget>[
Expanded(
flex: 5,
child: Material(
elevation: 20.0,
child: Container(
width: 200.0,
height: 150.0,
child: Column(
children: <Widget>[
Material(
child: Container(
width: 200.0,
height: 200.0,
child: ClipRRect(
child: Image(
image: AssetImage(
"lib/assets/images/$hangState.png"),
),
),
),
),
],
)),
),
),
Expanded(
flex: 2,
child: Container(
padding: EdgeInsets.all(15.0),
alignment: Alignment.bottomLeft,
child: Text(
mydata[0][i.toString()],
style: TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.w700,
),
),
decoration: BoxDecoration(
color: Colors.blueAccent,
),
),
),
Expanded(
flex: 6,
child: Container(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
choicebutton('a'),
choicebutton('b'),
choicebutton('c'),
choicebutton('d'),
],
),
),
),
Expanded(
flex: 1,
child: Container(
alignment: Alignment.topCenter,
child: Center(
child: Text(
showtimer,
style: TextStyle(
fontSize: 35.0,
fontWeight: FontWeight.w700,
),
),
),
decoration: BoxDecoration(
color: Colors.red,
),
),
),
],
),
),
);
}
}
import 'package:covidefender/STracker/PublicPlaces/publicPlacesQuizPage.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
class publicPlacesQuizStartPage extends StatefulWidget {
@override
_publicPlacesQuizStartPageState createState() => _publicPlacesQuizStartPageState();
}
class _publicPlacesQuizStartPageState extends State<publicPlacesQuizStartPage> {
List<String> images = [
"lib/assets/images/startQuiz.png",
];
Widget customcard(String type, String image) {
return Padding(
padding: EdgeInsets.all(
20.0,
),
child: InkWell(
onTap: () {
Navigator.of(context).pushReplacement(MaterialPageRoute(
builder: (context) => getjsonPublicPlaces(),
));
},
child: Material(
color: Colors.indigoAccent,
elevation: 10.0,
borderRadius: BorderRadius.circular(20.0),
child: Container(
child: Column(
children: <Widget>[
Padding(
padding: EdgeInsets.symmetric(
vertical: 10.0,
),
child: Material(
elevation: 5.0,
borderRadius: BorderRadius.circular(100.0),
child: Container(
height: 100.0,
width: 100.0,
child: ClipOval(
child: Image(
fit: BoxFit.contain,
image: AssetImage(
image,
),
),
),
),
),
),
Center(
child: Text(
type,
style: TextStyle(
fontSize: 24.0,
fontWeight: FontWeight.w700,
),
),
),
],
),
),
),
),
);
}
@override
Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations(
[DeviceOrientation.portraitDown, DeviceOrientation.portraitUp]);
return Scaffold(
appBar: AppBar(
title: Text("STracker"),
),
body: ListView(
children: <Widget>[
customcard("Start Quiz", images[0]),
],
),
);
}
}
import 'package:flutter/material.dart';
import '../levelsDashboard.dart';
import '../variables.dart';
class publicPlacesResultPage extends StatefulWidget {
int marks;
publicPlacesResultPage({Key key, @required this.marks}) : super(key: key);
@override
_publicPlacesResultPageState createState() => _publicPlacesResultPageState(marks);
}
class _publicPlacesResultPageState extends State<publicPlacesResultPage> {
int marks;
_publicPlacesResultPageState(this.marks);
@override
void initState() {
testMethod();
super.initState();
}
void testMethod() {
marks4 = this.marks;
}
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(
"Result for Public Places",
),
),
body: Column(
children: <Widget>[
Expanded(
flex: 7,
child: Material(
elevation: 10.0,
child: Container(
width: 300.0,
height: 300.0,
child: Column(
children: <Widget>[
Material(
child: Container(
width: 300.0,
height: 300.0,
child: ClipRRect(
child: Image(
image:
AssetImage("lib/assets/images/gameover.jpg"),
),
),
),
),
Padding(
padding: EdgeInsets.symmetric(
vertical: 5.0,
horizontal: 15.0,
),
child: Center(
child: Text(
"You Scored $marks marks",
style: TextStyle(
fontSize: 20.0,
fontWeight: FontWeight.w700,
),
),
)),
],
)),
),
),
Expanded(
flex: 4,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
OutlineButton(
onPressed: () {
Navigator.of(context).pushReplacement(MaterialPageRoute(
builder: (context) => levelsDashboard(),
));
},
child: Text(
"Continue",
style: TextStyle(
fontSize: 18.0,
),
),
padding: EdgeInsets.symmetric(
vertical: 10.0,
horizontal: 25.0,
),
borderSide: BorderSide(width: 3.0, color: Colors.indigo),
splashColor: Colors.indigoAccent,
)
],
),
)
],
),
);
}
}
import 'dart:async';
import 'dart:convert';
import 'package:covidefender/STracker/SocialDistance/socialDistanceResultPage.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
class getjsonSocialDistance extends StatelessWidget {
@override
Widget build(BuildContext context) {
return FutureBuilder(
future: DefaultAssetBundle.of(context)
.loadString("lib/assets/pythonSocialDistance.json"),
builder: (context, snapshot) {
List mydata = json.decode(snapshot.data.toString());
if (mydata == null) {
return Scaffold(
body: Center(
child: Text(
"Loading",
),
),
);
// return quizpage();
} else {
return quizpageSocialDistance(mydata: mydata);
}
});
}
}
class quizpageSocialDistance extends StatefulWidget {
var mydata;
quizpageSocialDistance({Key key, @required this.mydata}) : super(key: key);
@override
_quizpageSocialDistanceState createState() => _quizpageSocialDistanceState(mydata);
}
class _quizpageSocialDistanceState extends State<quizpageSocialDistance> {
var mydata;
_quizpageSocialDistanceState(this.mydata);
Color colortoshow = Colors.indigoAccent;
Color right = Colors.green;
Color wrong = Colors.red;
int marks = 0;
int i = 1;
int x = 0;
int timer = 60;
String showtimer = "60";
int hangState = 0;
Map<String, Color> btncolor = {
"a": Colors.indigoAccent,
"b": Colors.indigoAccent,
"c": Colors.indigoAccent,
"d": Colors.indigoAccent
};
bool canceltimer = false;
@override
void initState() {
starttimer();
super.initState();
}
void starttimer() async {
const onesec = Duration(seconds: 1);
Timer.periodic(onesec, (Timer t) {
setState(() {
if (timer < 1) {
t.cancel();
nextquestion();
} else if (canceltimer == true) {
t.cancel();
} else {
timer = timer - 1;
}
showtimer = timer.toString();
});
});
}
void nextquestion() {
canceltimer = false;
timer = 60;
setState(() {
if (i < 5) {
i++;
} else {
Navigator.of(context).pushReplacement(MaterialPageRoute(
builder: (context) => socialDistanceResultPage(marks: marks),
));
}
btncolor["a"] = Colors.indigoAccent;
btncolor["b"] = Colors.indigoAccent;
btncolor["c"] = Colors.indigoAccent;
btncolor["d"] = Colors.indigoAccent;
});
starttimer();
}
void checkanswer(String k) {
if (mydata[2][i.toString()] == mydata[1][i.toString()][k]) {
marks = marks + 5;
colortoshow = right;
} else {
colortoshow = wrong;
x = x + 1;
showHangman(x);
}
setState(() {
btncolor[k] = colortoshow;
canceltimer = true;
});
Timer(Duration(seconds: 2), nextquestion);
}
void showHangman(x) {
if (x == 1) {
hangState = 1;
} else if (x == 2) {
hangState = 2;
} else if (x == 3) {
hangState = 3;
} else if (x == 4) {
hangState = 4;
} else {
hangState = 5;
}
}
Widget choicebutton(String k) {
return Padding(
padding: EdgeInsets.symmetric(
vertical: 10.0,
horizontal: 20.0,
),
child: MaterialButton(
onPressed: () => checkanswer(k),
child: Text(
mydata[1][i.toString()][k],
style: TextStyle(
color: Colors.white,
fontSize: 16.0,
),
maxLines: 1,
),
color: btncolor[k],
splashColor: Colors.indigo[700],
highlightColor: Colors.indigo[700],
minWidth: 200.0,
height: 45.0,
shape:
RoundedRectangleBorder(borderRadius: BorderRadius.circular(20.0)),
),
);
}
@override
Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations(
[DeviceOrientation.portraitDown, DeviceOrientation.portraitUp]);
return WillPopScope(
onWillPop: () {
return showDialog(
context: context,
builder: (context) => AlertDialog(
title: Text(
"QuizStar - Warning",
),
content: Text("You can't go back at this stage"),
actions: <Widget>[
FlatButton(
onPressed: () {
Navigator.of(context).pop();
},
child: Text(
'OK',
),
)
],
));
},
child: Scaffold(
body: Column(
children: <Widget>[
Expanded(
flex: 5,
child: Material(
elevation: 20.0,
child: Container(
width: 200.0,
height: 150.0,
child: Column(
children: <Widget>[
Material(
child: Container(
width: 200.0,
height: 200.0,
child: ClipRRect(
child: Image(
image: AssetImage(
"lib/assets/images/$hangState.png"),
),
),
),
),
],
)),
),
),
Expanded(
flex: 2,
child: Container(
padding: EdgeInsets.all(15.0),
alignment: Alignment.bottomLeft,
child: Text(
mydata[0][i.toString()],
style: TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.w700,
),
),
decoration: BoxDecoration(
color: Colors.blueAccent,
),
),
),
Expanded(
flex: 6,
child: Container(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
choicebutton('a'),
choicebutton('b'),
choicebutton('c'),
choicebutton('d'),
],
),
),
),
Expanded(
flex: 1,
child: Container(
alignment: Alignment.topCenter,
child: Center(
child: Text(
showtimer,
style: TextStyle(
fontSize: 35.0,
fontWeight: FontWeight.w700,
),
),
),
decoration: BoxDecoration(
color: Colors.red,
),
),
),
],
),
),
);
}
}
import 'package:covidefender/STracker/SocialDistance/socialDistanceQuizPage.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
class socialDistanceQuizStartPage extends StatefulWidget {
@override
_socialDistanceQuizStartPageState createState() => _socialDistanceQuizStartPageState();
}
class _socialDistanceQuizStartPageState extends State<socialDistanceQuizStartPage> {
List<String> images = [
"lib/assets/images/startQuiz.png",
];
Widget customcard(String type, String image) {
return Padding(
padding: EdgeInsets.all(
20.0,
),
child: InkWell(
onTap: () {
Navigator.of(context).pushReplacement(MaterialPageRoute(
builder: (context) => getjsonSocialDistance(),
));
},
child: Material(
color: Colors.indigoAccent,
elevation: 10.0,
borderRadius: BorderRadius.circular(20.0),
child: Container(
child: Column(
children: <Widget>[
Padding(
padding: EdgeInsets.symmetric(
vertical: 10.0,
),
child: Material(
elevation: 5.0,
borderRadius: BorderRadius.circular(100.0),
child: Container(
height: 100.0,
width: 100.0,
child: ClipOval(
child: Image(
fit: BoxFit.contain,
image: AssetImage(
image,
),
),
),
),
),
),
Center(
child: Text(
type,
style: TextStyle(
fontSize: 24.0,
fontWeight: FontWeight.w700,
),
),
),
],
),
),
),
),
);
}
@override
Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations(
[DeviceOrientation.portraitDown, DeviceOrientation.portraitUp]);
return Scaffold(
appBar: AppBar(
title: Text("STracker"),
),
body: ListView(
children: <Widget>[
customcard("Start Quiz", images[0]),
],
),
);
}
}
import 'package:flutter/material.dart';
import '../levelsDashboard.dart';
import '../variables.dart';
class socialDistanceResultPage extends StatefulWidget {
int marks;
socialDistanceResultPage({Key key, @required this.marks}) : super(key: key);
@override
_socialDistanceResultPageState createState() => _socialDistanceResultPageState(marks);
}
class _socialDistanceResultPageState extends State<socialDistanceResultPage> {
int marks;
_socialDistanceResultPageState(this.marks);
@override
void initState() {
testMethod();
super.initState();
}
void testMethod() {
marks3 = this.marks;
}
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(
"Result for Social Distance",
),
),
body: Column(
children: <Widget>[
Expanded(
flex: 7,
child: Material(
elevation: 10.0,
child: Container(
width: 300.0,
height: 300.0,
child: Column(
children: <Widget>[
Material(
child: Container(
width: 300.0,
height: 300.0,
child: ClipRRect(
child: Image(
image:
AssetImage("lib/assets/images/gameover.jpg"),
),
),
),
),
Padding(
padding: EdgeInsets.symmetric(
vertical: 5.0,
horizontal: 15.0,
),
child: Center(
child: Text(
"You Scored $marks marks",
style: TextStyle(
fontSize: 20.0,
fontWeight: FontWeight.w700,
),
),
)),
],
)),
),
),
Expanded(
flex: 4,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
OutlineButton(
onPressed: () {
Navigator.of(context).pushReplacement(MaterialPageRoute(
builder: (context) => levelsDashboard(),
));
},
child: Text(
"Continue",
style: TextStyle(
fontSize: 18.0,
),
),
padding: EdgeInsets.symmetric(
vertical: 10.0,
horizontal: 25.0,
),
borderSide: BorderSide(width: 3.0, color: Colors.indigo),
splashColor: Colors.indigoAccent,
)
],
),
)
],
),
);
}
}
import 'dart:async';
import 'dart:convert';
import 'package:covidefender/STracker/SocialDistance/socialDistanceResultPage.dart';
import 'package:covidefender/STracker/Symptoms/symptomsResultPage.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
class getjsonSymptoms extends StatelessWidget {
@override
Widget build(BuildContext context) {
return FutureBuilder(
future: DefaultAssetBundle.of(context)
.loadString("lib/assets/pythonSymptoms.json"),
builder: (context, snapshot) {
List mydata = json.decode(snapshot.data.toString());
if (mydata == null) {
return Scaffold(
body: Center(
child: Text(
"Loading",
),
),
);
// return quizpage();
} else {
return quizpageSymptoms(mydata: mydata);
}
});
}
}
class quizpageSymptoms extends StatefulWidget {
var mydata;
quizpageSymptoms({Key key, @required this.mydata}) : super(key: key);
@override
_quizpageSymptomsState createState() => _quizpageSymptomsState(mydata);
}
class _quizpageSymptomsState extends State<quizpageSymptoms> {
var mydata;
_quizpageSymptomsState(this.mydata);
Color colortoshow = Colors.indigoAccent;
Color right = Colors.green;
Color wrong = Colors.red;
int marks = 0;
int i = 1;
int x = 0;
int timer = 60;
String showtimer = "60";
int hangState = 0;
Map<String, Color> btncolor = {
"a": Colors.indigoAccent,
"b": Colors.indigoAccent,
"c": Colors.indigoAccent,
"d": Colors.indigoAccent
};
bool canceltimer = false;
@override
void initState() {
starttimer();
super.initState();
}
void starttimer() async {
const onesec = Duration(seconds: 1);
Timer.periodic(onesec, (Timer t) {
setState(() {
if (timer < 1) {
t.cancel();
nextquestion();
} else if (canceltimer == true) {
t.cancel();
} else {
timer = timer - 1;
}
showtimer = timer.toString();
});
});
}
void nextquestion() {
canceltimer = false;
timer = 60;
setState(() {
if (i < 5) {
i++;
} else {
Navigator.of(context).pushReplacement(MaterialPageRoute(
builder: (context) => symptomsResultPage(marks: marks),
));
}
btncolor["a"] = Colors.indigoAccent;
btncolor["b"] = Colors.indigoAccent;
btncolor["c"] = Colors.indigoAccent;
btncolor["d"] = Colors.indigoAccent;
});
starttimer();
}
void checkanswer(String k) {
if (mydata[2][i.toString()] == mydata[1][i.toString()][k]) {
marks = marks + 5;
colortoshow = right;
} else {
colortoshow = wrong;
x = x + 1;
showHangman(x);
}
setState(() {
btncolor[k] = colortoshow;
canceltimer = true;
});
Timer(Duration(seconds: 2), nextquestion);
}
void showHangman(x) {
if (x == 1) {
hangState = 1;
} else if (x == 2) {
hangState = 2;
} else if (x == 3) {
hangState = 3;
} else if (x == 4) {
hangState = 4;
} else {
hangState = 5;
}
}
Widget choicebutton(String k) {
return Padding(
padding: EdgeInsets.symmetric(
vertical: 10.0,
horizontal: 20.0,
),
child: MaterialButton(
onPressed: () => checkanswer(k),
child: Text(
mydata[1][i.toString()][k],
style: TextStyle(
color: Colors.white,
fontSize: 16.0,
),
maxLines: 1,
),
color: btncolor[k],
splashColor: Colors.indigo[700],
highlightColor: Colors.indigo[700],
minWidth: 200.0,
height: 45.0,
shape:
RoundedRectangleBorder(borderRadius: BorderRadius.circular(20.0)),
),
);
}
@override
Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations(
[DeviceOrientation.portraitDown, DeviceOrientation.portraitUp]);
return WillPopScope(
onWillPop: () {
return showDialog(
context: context,
builder: (context) => AlertDialog(
title: Text(
"QuizStar - Warning",
),
content: Text("You can't go back at this stage"),
actions: <Widget>[
FlatButton(
onPressed: () {
Navigator.of(context).pop();
},
child: Text(
'OK',
),
)
],
));
},
child: Scaffold(
body: Column(
children: <Widget>[
Expanded(
flex: 5,
child: Material(
elevation: 20.0,
child: Container(
width: 200.0,
height: 150.0,
child: Column(
children: <Widget>[
Material(
child: Container(
width: 200.0,
height: 200.0,
child: ClipRRect(
child: Image(
image: AssetImage(
"lib/assets/images/$hangState.png"),
),
),
),
),
],
)),
),
),
Expanded(
flex: 2,
child: Container(
padding: EdgeInsets.all(15.0),
alignment: Alignment.bottomLeft,
child: Text(
mydata[0][i.toString()],
style: TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.w700,
),
),
decoration: BoxDecoration(
color: Colors.blueAccent,
),
),
),
Expanded(
flex: 6,
child: Container(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
choicebutton('a'),
choicebutton('b'),
choicebutton('c'),
choicebutton('d'),
],
),
),
),
Expanded(
flex: 1,
child: Container(
alignment: Alignment.topCenter,
child: Center(
child: Text(
showtimer,
style: TextStyle(
fontSize: 35.0,
fontWeight: FontWeight.w700,
),
),
),
decoration: BoxDecoration(
color: Colors.red,
),
),
),
],
),
),
);
}
}
import 'package:covidefender/STracker/SocialDistance/socialDistanceQuizPage.dart';
import 'package:covidefender/STracker/Symptoms/symptomsQuizPage.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
class symptomsQuizStartPage extends StatefulWidget {
@override
_symptomsQuizStartPageState createState() => _symptomsQuizStartPageState();
}
class _symptomsQuizStartPageState extends State<symptomsQuizStartPage> {
List<String> images = [
"lib/assets/images/startQuiz.png",
];
Widget customcard(String type, String image) {
return Padding(
padding: EdgeInsets.all(
20.0,
),
child: InkWell(
onTap: () {
Navigator.of(context).pushReplacement(MaterialPageRoute(
builder: (context) => getjsonSymptoms(),
));
},
child: Material(
color: Colors.indigoAccent,
elevation: 10.0,
borderRadius: BorderRadius.circular(20.0),
child: Container(
child: Column(
children: <Widget>[
Padding(
padding: EdgeInsets.symmetric(
vertical: 10.0,
),
child: Material(
elevation: 5.0,
borderRadius: BorderRadius.circular(100.0),
child: Container(
height: 100.0,
width: 100.0,
child: ClipOval(
child: Image(
fit: BoxFit.contain,
image: AssetImage(
image,
),
),
),
),
),
),
Center(
child: Text(
type,
style: TextStyle(
fontSize: 24.0,
fontWeight: FontWeight.w700,
),
),
),
],
),
),
),
),
);
}
@override
Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations(
[DeviceOrientation.portraitDown, DeviceOrientation.portraitUp]);
return Scaffold(
appBar: AppBar(
title: Text("STracker"),
),
body: ListView(
children: <Widget>[
customcard("Start Quiz", images[0]),
],
),
);
}
}
import 'package:flutter/material.dart';
import '../levelsDashboard.dart';
import '../variables.dart';
class symptomsResultPage extends StatefulWidget {
int marks;
symptomsResultPage({Key key, @required this.marks}) : super(key: key);
@override
_symptomsResultPageState createState() => _symptomsResultPageState(marks);
}
class _symptomsResultPageState extends State<symptomsResultPage> {
int marks;
_symptomsResultPageState(this.marks);
@override
void initState() {
testMethod();
super.initState();
}
void testMethod() {
marks5 = this.marks;
}
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(
"Result for Social Distance",
),
),
body: Column(
children: <Widget>[
Expanded(
flex: 7,
child: Material(
elevation: 10.0,
child: Container(
width: 300.0,
height: 300.0,
child: Column(
children: <Widget>[
Material(
child: Container(
width: 300.0,
height: 300.0,
child: ClipRRect(
child: Image(
image:
AssetImage("lib/assets/images/gameover.jpg"),
),
),
),
),
Padding(
padding: EdgeInsets.symmetric(
vertical: 5.0,
horizontal: 15.0,
),
child: Center(
child: Text(
"You Scored $marks marks",
style: TextStyle(
fontSize: 20.0,
fontWeight: FontWeight.w700,
),
),
)),
],
)),
),
),
Expanded(
flex: 4,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
OutlineButton(
onPressed: () {
Navigator.of(context).pushReplacement(MaterialPageRoute(
builder: (context) => levelsDashboard(),
));
},
child: Text(
"Continue",
style: TextStyle(
fontSize: 18.0,
),
),
padding: EdgeInsets.symmetric(
vertical: 10.0,
horizontal: 25.0,
),
borderSide: BorderSide(width: 3.0, color: Colors.indigo),
splashColor: Colors.indigoAccent,
)
],
),
)
],
),
);
}
}
import 'package:flutter/material.dart';
import 'levelsDashboard.dart';
import 'variables.dart';
class finalResult extends StatefulWidget {
int marks;
finalResult() : super();
@override
_finalResultState createState() => _finalResultState();
}
class _finalResultState extends State<finalResult> {
int marks;
_finalResultState();
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(
"Final Result",
),
),
body: Column(
children: <Widget>[
Expanded(
flex: 20,
child: Material(
elevation: 10.0,
child: Container(
width: 300.0,
height: 300.0,
child: Column(
children: <Widget>[
Material(
child: Container(
width: 300.0,
height: 300.0,
child: ClipRRect(
child: Image(
image:
AssetImage("lib/assets/images/gameover.jpg"),
),
),
),
),
Padding(
padding: EdgeInsets.symmetric(
vertical: 5.0,
horizontal: 15.0,
),
child: Center(
child: Text(
"Hand Washing - $marks1",
style: TextStyle(
fontSize: 20.0,
fontWeight: FontWeight.w700,
),
),
)),
Padding(
padding: EdgeInsets.symmetric(
vertical: 5.0,
horizontal: 15.0,
),
child: Center(
child: Text(
"Mask Wearing - $marks2",
style: TextStyle(
fontSize: 20.0,
fontWeight: FontWeight.w700,
),
),
)),
Padding(
padding: EdgeInsets.symmetric(
vertical: 5.0,
horizontal: 15.0,
),
child: Center(
child: Text(
"Social Distance - $marks3",
style: TextStyle(
fontSize: 20.0,
fontWeight: FontWeight.w700,
),
),
)),
Padding(
padding: EdgeInsets.symmetric(
vertical: 5.0,
horizontal: 15.0,
),
child: Center(
child: Text(
"Public places - $marks4",
style: TextStyle(
fontSize: 20.0,
fontWeight: FontWeight.w700,
),
),
)),
Padding(
padding: EdgeInsets.symmetric(
vertical: 5.0,
horizontal: 15.0,
),
child: Center(
child: Text(
"Symptoms - $marks5",
style: TextStyle(
fontSize: 20.0,
fontWeight: FontWeight.w700,
),
),
)),
],
)),
),
),
Expanded(
flex: 4,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
OutlineButton(
onPressed: () {
Navigator.of(context).pushReplacement(MaterialPageRoute(
builder: (context) => levelsDashboard(),
));
},
child: Text(
"Continue",
style: TextStyle(
fontSize: 18.0,
),
),
padding: EdgeInsets.symmetric(
vertical: 10.0,
horizontal: 25.0,
),
borderSide: BorderSide(width: 3.0, color: Colors.indigo),
splashColor: Colors.indigoAccent,
)
],
),
)
],
),
);
}
}
import 'package:covidefender/STracker/MaskWearing/maskWearingQuizStartPage.dart';
import 'package:covidefender/STracker/PublicPlaces/publicPlacesQuizStartPage.dart';
import 'package:covidefender/STracker/SocialDistance/socialDistanceQuizStartPage.dart';
import 'package:covidefender/STracker/Symptoms/symptomsQuizStartPage.dart';
import 'package:covidefender/STracker/finalResult.dart';
import 'package:flutter/material.dart';
import 'home.dart';
import 'HandWashing/home.dart';
class levelsDashboard extends StatefulWidget {
@override
......@@ -94,12 +99,14 @@ class _levelsDashboardState extends State<levelsDashboard> {
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
FlatButton(
// onPressed: () {
// Navigator.push(
// context,
// MaterialPageRoute(builder: (context) => EAnalyzerDash()),
// );
// },
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
maskWearingQuizStartPage()),
);
},
child: Image.asset(
'lib/assets/images/maskWearing.png'),
),
......@@ -115,12 +122,14 @@ class _levelsDashboardState extends State<levelsDashboard> {
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
FlatButton(
// onPressed: () {
// Navigator.push(
// context,
// MaterialPageRoute(builder: (context) => EAnalyzerDash()),
// );
// },
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
socialDistanceQuizStartPage()),
);
},
child: Image.asset(
'lib/assets/images/socialDistance.png'),
),
......@@ -136,12 +145,14 @@ class _levelsDashboardState extends State<levelsDashboard> {
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
FlatButton(
// onPressed: () {
// Navigator.push(
// context,
// MaterialPageRoute(builder: (context) => EAnalyzerDash()),
// );
// },
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
publicPlacesQuizStartPage()),
);
},
child: Image.asset(
'lib/assets/images/publicPlaces.png'),
),
......@@ -157,12 +168,12 @@ class _levelsDashboardState extends State<levelsDashboard> {
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
FlatButton(
// onPressed: () {
// Navigator.push(
// context,
// MaterialPageRoute(builder: (context) => EAnalyzerDash()),
// );
// },
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => symptomsQuizStartPage()),
);
},
child: Image.asset(
'lib/assets/images/symptoms.png'),
),
......@@ -170,6 +181,27 @@ class _levelsDashboardState extends State<levelsDashboard> {
style: TextStyle(fontSize: 20.0))
],
)),
Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8)),
elevation: 4,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
FlatButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => finalResult()),
);
},
child: Image.asset(
'lib/assets/images/symptoms.png'),
),
Text('Final Result',
style: TextStyle(fontSize: 20.0))
],
)),
],
),
)
......
//global variables for STracker
int marks1 = 0;
int marks2 = 0;
int marks3 = 0;
int marks4 = 0;
int marks5 = 0;
[
{
"1": "Question 1: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"2": "Question 2: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"3": "Question 3: ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc",
"4": "Question 4: ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd",
"5": "Question 5: eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"
},
{
"1": {
"a": "Keep my hands beautiful",
"b": "Wash my hands of germs",
"c": "To get smooth feel to hand",
"d": "To get a new look on hand"
},
"2": {
"a": "Operate by hand",
"b": "Operate by mouth",
"c": "Operate by nose",
"d": "Operate by leg"
},
"3": {
"a": "May be",
"b": "Sometimes",
"c": "Yes, it is must",
"d": "Never"
},
"4": {
"a": "Yes. must to do",
"b": "Sometimes",
"c": "No need to do always",
"d": "Not applicable"
},
"5": {
"a": "Tank water",
"b": "Filtered water",
"c": "Clean, running water",
"d": "Well water"
}
},
{
"1": "Wash my hands of germs",
"2": "Operate by leg",
"3": "Yes, it is must",
"4": "Yes. must to do",
"5": "Clean, running water"
}
]
\ No newline at end of file
[
{
"1": "Question 1: ppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp",
"2": "Question 2: lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll",
"3": "Question 3: sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss",
"4": "Question 4: ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd",
"5": "Question 5: eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"
},
{
"1": {
"a": "Keep my hands beautiful",
"b": "Wash my hands of germs",
"c": "To get smooth feel to hand",
"d": "To get a new look on hand"
},
"2": {
"a": "Operate by hand",
"b": "Operate by mouth",
"c": "Operate by nose",
"d": "Operate by leg"
},
"3": {
"a": "May be",
"b": "Sometimes",
"c": "Yes, it is must",
"d": "Never"
},
"4": {
"a": "Yes. must to do",
"b": "Sometimes",
"c": "No need to do always",
"d": "Not applicable"
},
"5": {
"a": "Tank water",
"b": "Filtered water",
"c": "Clean, running water",
"d": "Well water"
}
},
{
"1": "Wash my hands of germs",
"2": "Operate by leg",
"3": "Yes, it is must",
"4": "Yes. must to do",
"5": "Clean, running water"
}
]
\ No newline at end of file
[
{
"1": "Question 1: sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss",
"2": "Question 2: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"3": "Question 3: sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss",
"4": "Question 4: ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd",
"5": "Question 5: eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"
},
{
"1": {
"a": "Keep my hands beautiful",
"b": "Wash my hands of germs",
"c": "To get smooth feel to hand",
"d": "To get a new look on hand"
},
"2": {
"a": "Operate by hand",
"b": "Operate by mouth",
"c": "Operate by nose",
"d": "Operate by leg"
},
"3": {
"a": "May be",
"b": "Sometimes",
"c": "Yes, it is must",
"d": "Never"
},
"4": {
"a": "Yes. must to do",
"b": "Sometimes",
"c": "No need to do always",
"d": "Not applicable"
},
"5": {
"a": "Tank water",
"b": "Filtered water",
"c": "Clean, running water",
"d": "Well water"
}
},
{
"1": "Wash my hands of germs",
"2": "Operate by leg",
"3": "Yes, it is must",
"4": "Yes. must to do",
"5": "Clean, running water"
}
]
\ No newline at end of file
[
{
"1": "Question 1: yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy",
"2": "Question 2: mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm",
"3": "Question 3: sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss",
"4": "Question 4: ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd",
"5": "Question 5: eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"
},
{
"1": {
"a": "Keep my hands beautiful",
"b": "Wash my hands of germs",
"c": "To get smooth feel to hand",
"d": "To get a new look on hand"
},
"2": {
"a": "Operate by hand",
"b": "Operate by mouth",
"c": "Operate by nose",
"d": "Operate by leg"
},
"3": {
"a": "May be",
"b": "Sometimes",
"c": "Yes, it is must",
"d": "Never"
},
"4": {
"a": "Yes. must to do",
"b": "Sometimes",
"c": "No need to do always",
"d": "Not applicable"
},
"5": {
"a": "Tank water",
"b": "Filtered water",
"c": "Clean, running water",
"d": "Well water"
}
},
{
"1": "Wash my hands of germs",
"2": "Operate by leg",
"3": "Yes, it is must",
"4": "Yes. must to do",
"5": "Clean, running water"
}
]
\ No newline at end of file
......@@ -25,7 +25,7 @@ class _HomeScreenState extends State<HomeScreen> {
body: Stack(
children: <Widget>[
Container(
height: size.height * .4,
height: size.height * .2,
decoration: BoxDecoration(
image: DecorationImage(
alignment: Alignment.topCenter,
......
......@@ -107,7 +107,7 @@ packages:
name: cupertino_icons
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.2"
version: "1.0.3"
fake_async:
dependency: transitive
description:
......@@ -141,6 +141,13 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_spinkit:
dependency: "direct main"
description:
name: flutter_spinkit
url: "https://pub.dartlang.org"
source: hosted
version: "4.1.2+1"
flutter_svg:
dependency: "direct main"
description:
......@@ -158,6 +165,13 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
http:
dependency: "direct main"
description:
name: http
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.2"
http_parser:
dependency: transitive
description:
......@@ -220,21 +234,21 @@ packages:
name: path_drawing
url: "https://pub.dartlang.org"
source: hosted
version: "0.5.0"
version: "0.5.1"
path_parsing:
dependency: transitive
description:
name: path_parsing
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.0"
version: "0.2.1"
pedantic:
dependency: transitive
description:
name: pedantic
url: "https://pub.dartlang.org"
source: hosted
version: "1.11.0"
version: "1.11.1"
petitparser:
dependency: transitive
description:
......@@ -267,7 +281,7 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0"
version: "1.8.1"
stack_trace:
dependency: transitive
description:
......@@ -309,7 +323,7 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.19"
version: "0.3.0"
tflite:
dependency: "direct main"
description:
......@@ -344,7 +358,7 @@ packages:
name: xml
url: "https://pub.dartlang.org"
source: hosted
version: "5.1.0"
version: "5.1.2"
sdks:
dart: ">=2.12.0 <3.0.0"
flutter: ">=1.24.0-7.0"
......@@ -21,14 +21,18 @@ environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
flutter_svg: ^0.22.0
cloud_firestore: ^0.14.3
firebase_core : ^0.5.0
tflite: ^1.1.1
oktoast: ^2.3.2
quiver: ^2.0.0
cloud_firestore: ^0.14.3
firebase_core : ^0.5.0
wakelock: ^0.1.4+1
charts_flutter: ^0.9.0
flutter_spinkit: "^4.1.2"
......@@ -40,13 +44,17 @@ dependencies:
#add dependencies for heart rate module
charts_flutter: ^0.9.0
wakelock: ^0.1.4+1
camera:
git:
url: http://github.com/indikaNK/plugins.git
path: packages/camera/camera
dev_dependencies:
flutter_test:
sdk: flutter
......@@ -78,6 +86,8 @@ flutter:
- lib/assets/images/feedback80.png
- lib/assets/images/list80.png
- lib/assets/images/search80.png
- lib/assets/
- lib/assets/images/awrenessLevel.png
- lib/assets/images/exit.png
......@@ -93,6 +103,14 @@ flutter:
- lib/assets/images/socialDistance.png
- lib/assets/images/symptoms.png
- lib/assets/images/startQuiz.png
- lib/assets/images/0.png
- lib/assets/images/1.png
- lib/assets/images/2.png
- lib/assets/images/3.png
- lib/assets/images/4.png
- lib/assets/images/5.png
- lib/assets/images/6.png
- lib/assets/images/hero.gif
- lib/assets/images/lab.gif
- lib/assets/images/map80.png
......
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