Commit c15ed477 authored by indika N kumara's avatar indika N kumara

Merge branch 'develop_1' into 'EAnalyzer_KarunaratneGP'

# Conflicts:
#   .vscode/launch.json
#   android/app/src/main/AndroidManifest.xml
#   lib/EAnalyzer/AddLocation.dart
#   lib/home_screen.dart
#   pubspec.lock
#   pubspec.yaml
parents 4bd0762c 4aac3c3f
No preview for this file type
......@@ -5,11 +5,15 @@
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"name": "covidefender",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
"type": "dart"
},
{
"name": "covidefender (profile mode)",
"request": "launch",
"type": "dart",
"flutterMode": "profile"
}
]
}
\ No newline at end of file
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.covidefender">
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application
android:label="covidefender"
android:icon="@mipmap/ic_launcher">
<meta-data android:name="com.google.android.geo.API_KEY"
android:value="AIzaSyBuDih9ioyQAR9ikg3zEoE_5mhXvZh5oAw"/>
<meta-data android:name="com.google.android.geo.API_KEY"
android:value="AIzaSyBuDih9ioyQAR9ikg3zEoE_5mhXvZh5oAw"/>
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
......@@ -33,7 +35,17 @@
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter>
<action android:name="FLUTTER_NOTIFICATION_CLICK" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<receiver android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationBootReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"></action>
</intent-filter>
</receiver>
<receiver android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationReceiver" />
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
......
......@@ -7,105 +7,107 @@ class AddLocation extends StatefulWidget {
}
class AddLocationState extends State<AddLocation> {
String userName;
String phoneNumber;
String riskLocation;
String hotelName;
String date;
String time;
getUserName(name) {
this.userName = name;
}
String userName;
String phoneNumber;
String riskLocation;
String hotelName;
String date;
String time;
getUserName(name){
this.userName= name;
}
getPhoneNumber(pno) {
this.phoneNumber = pno;
}
getPhoneNumber(pno){
this.phoneNumber= pno;
}
getRiskLocation(location) {
this.riskLocation = location;
}
getRiskLocation(location){
this.riskLocation= location;
}
getHotelName(hotelname) {
this.hotelName = hotelname;
}
getHotelName(hotelname){
this.hotelName= hotelname;
}
getDate(date) {
this.date = date;
}
getDate(date){
this.date= date;
}
getTime(time) {
this.time = time;
}
getTime(time){
this.time= time;
}
//---------------------------------------------Create Data-----------------------------------------------------
createData(){
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 created");
});
}
createData() {
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 created");
});
}
//---------------------------------------------Read Data-----------------------------------------------------
readData() {
DocumentReference documentReference =
Firestore.instance.collection("RiskLocation").document(userName);
readData(){
DocumentReference documentReference = Firestore.instance.collection("RiskLocation").document(userName);
documentReference.get().then((datasnapshot){
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");
updateData() {
print("object");
DocumentReference documentReference = Firestore.instance.collection("RiskLocation").document(userName);
DocumentReference documentReference =
Firestore.instance.collection("RiskLocation").document(userName);
Map<String, dynamic> locations ={
"userName": userName,
"phoneNumber": phoneNumber,
"riskLocation": riskLocation,
"hotelName": hotelName,
"date": date,
"time": time
};
Map<String, dynamic> locations = {
"userName": userName,
"phoneNumber": phoneNumber,
"riskLocation": riskLocation,
"hotelName": hotelName,
"date": date,
"time": time
};
documentReference.setData(locations).whenComplete(() {
print("$userName Updated");
});
}
documentReference.setData(locations).whenComplete(() {
print("$userName Updated");
});
}
//---------------------------------------------Delete Data-----------------------------------------------------
deleteData(){
DocumentReference documentReference = Firestore.instance.collection("RiskLocation").document(userName);
documentReference.delete().whenComplete((){
print("$userName Deleted");
});
}
deleteData() {
DocumentReference documentReference =
Firestore.instance.collection("RiskLocation").document(userName);
documentReference.delete().whenComplete(() {
print("$userName Deleted");
});
}
final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
//---------------------------------------------User Name-----------------------------------------------------
Widget _buildName(){
return TextFormField(
......@@ -300,7 +302,7 @@ Widget _buildTime(){
title: Text("Add Risk Location"),
),
body: Container(
margin: EdgeInsets.all(24),
margin: EdgeInsets.all(24),
child: Form(
key: _formKey,
child: ListView(
......
import 'package:covidefender/pages/heart_rate/heart_rate_screen.dart';
import 'package:covidefender/pages/mask_detect/invoker.dart';
import 'package:covidefender/pages/notificator/ui/MainNotificationUI.dart';
import 'package:covidefender/pages/notificator/ui/notificator.dart';
import 'package:covidefender/pages/self_carer/sc_main_screen.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class I_guider extends StatelessWidget {
@override
Widget build(BuildContext context) {
final mesure = MediaQuery.of(context);
return Scaffold(
backgroundColor: Colors.grey[200],
backgroundColor: Colors.white,
appBar: AppBar(
centerTitle: true,
title: Text('I-Guider'),
// elevation: 0,
),
body: Column(
children: [
Row(
children: [
Expanded(
child: Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage('lib/assets/images/hero.gif'),
fit: BoxFit.cover)),
height: 300,
body: SingleChildScrollView(
child: Column(
children: [
Row(
children: [
Expanded(
child: Container(
height: mesure.size.height/3,
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage('lib/assets/images/hero.gif'),
fit: BoxFit.cover)),
),
),
),
],
),
//------------------------------------
],
),
//------------------------------------
SizedBox(
height: 50,
),
SizedBox(
height: 50,
),
Row(
children: [
Expanded(
child: Padding(
padding: const EdgeInsets.fromLTRB(8, 0, 8, 0),
child: ButtonTheme(
minWidth: 100.0,
height: 150.0,
child: RaisedButton.icon(
icon: Icon(
Icons.bluetooth_audio_rounded,
size: 40,
color: Colors.white,
Row(
children: [
Expanded(
child: Padding(
padding: const EdgeInsets.fromLTRB(8, 0, 8, 0),
child: ButtonTheme(
splashColor: Colors.blue,
minWidth: 100.0,
height: 150.0,
child: RaisedButton.icon(
icon: Column(
children: [
Icon(
Icons.notifications,
size: 40,
color: Colors.white,
),
SizedBox(height: 20),
Text("Notificator",style:TextStyle(
fontWeight: FontWeight.bold,
color: Colors.white
) ,)
],
),
label: Text('',
style: TextStyle(fontWeight: FontWeight.bold)),
onPressed: () {
Navigator.push(context, MaterialPageRoute(builder: (context) => MainNotificationUI() ));
},
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10)),
color: Colors.blue[200],
),
label: Text('',
style: TextStyle(fontWeight: FontWeight.bold)),
onPressed: () {},
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10)),
color: Colors.blue[200],
),
),
),
),
Expanded(
child: Padding(
padding: const EdgeInsets.fromLTRB(8, 0, 8, 0),
child: ButtonTheme(
minWidth: 100.0,
height: 150.0,
child: RaisedButton.icon(
color: Colors.greenAccent,
icon: Icon(
Icons.face_unlock_sharp,
size: 60,
color: Colors.white,
),
label: Text(
'',
style: TextStyle(fontWeight: FontWeight.bold),
Expanded(
child: Padding(
padding: const EdgeInsets.fromLTRB(8, 0, 8, 0),
child: ButtonTheme(
minWidth: 100.0,
height: 150.0,
child: RaisedButton.icon(
color: Colors.greenAccent,
icon: Column(
children: [
Icon(
Icons.face_unlock_sharp,
size: 60,
color: Colors.white,
),
SizedBox(height: 20),
Text("Mask Detector",style:TextStyle(
fontWeight: FontWeight.bold,
color: Colors.white
) ,)
],
),
label: Text(
'',
style: TextStyle(fontWeight: FontWeight.bold),
),
onPressed: () {
print('face mask detection');
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => invoker())
);
// Navigator.pushNamed(context, '/invoker');
},
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10)),
),
onPressed: () {
print('face mask detection');
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => invoker())
);
// Navigator.pushNamed(context, '/invoker');
},
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10)),
),
),
),
)
],
),
SizedBox(height: 30),
Row(
children: [
Expanded(
child: Padding(
padding: const EdgeInsets.fromLTRB(8, 0, 8, 0),
child: ButtonTheme(
minWidth: 100.0,
height: 150.0,
child: RaisedButton.icon(
icon: Icon(
Icons.view_stream_outlined,
size: 40,
color: Colors.white,
)
],
),
SizedBox(height: 30),
Row(
children: [
Expanded(
child: Padding(
padding: const EdgeInsets.fromLTRB(8, 0, 8, 0),
child: ButtonTheme(
minWidth: 100.0,
height: 150.0,
child: RaisedButton.icon(
icon: Column(
children: [
Icon(
Icons.view_stream_outlined,
size: 40,
color: Colors.white,
),
SizedBox(height: 20),
Text("Heart Monitor",style:TextStyle(
fontWeight: FontWeight.bold,
color: Colors.white
) ,)
],
),
label: Text('',
style: TextStyle(fontWeight: FontWeight.bold)),
onPressed: () {
// action when button is pressed route to heart rate measurer
Navigator.push(context, MaterialPageRoute(builder: (context) => HeartRateScreen() ));
},
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10)),
color: Colors.redAccent,
),
label: Text('',
style: TextStyle(fontWeight: FontWeight.bold)),
onPressed: () {
// action when button is pressed route to heart rate measurer
Navigator.push(context, MaterialPageRoute(builder: (context) => HeartRateScreen() ));
},
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10)),
color: Colors.redAccent,
),
),
),
),
Expanded(
child: Padding(
padding: const EdgeInsets.fromLTRB(8, 0, 8, 0),
child: ButtonTheme(
minWidth: 100.0,
height: 150.0,
child: RaisedButton.icon(
color: Colors.purple[200],
icon: Icon(
Icons.online_prediction_sharp,
size: 60,
color: Colors.white,
Expanded(
child: Padding(
padding: const EdgeInsets.fromLTRB(8, 0, 8, 0),
child: ButtonTheme(
minWidth: 100.0,
height: 150.0,
child: RaisedButton.icon(
color: Colors.purple[200],
icon: Column(
children: [
Icon(
Icons.online_prediction_sharp,
size: 60,
color: Colors.white,
),
SizedBox(height: 20),
Text("Self-Carer",style:TextStyle(
fontWeight: FontWeight.bold,
color: Colors.white
) ,)
],
),
label: Text(
'',
style: TextStyle(fontWeight: FontWeight.bold),
),
onPressed: () {
Navigator.push(context, MaterialPageRoute(builder: (context)=> SC_main()));
},
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10)),
),
label: Text(
'',
style: TextStyle(fontWeight: FontWeight.bold),
),
onPressed: () {},
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10)),
),
),
),
)
],
),
],
)
],
),
],
),
),
);
}
......
import 'dart:async';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
class MapDesignPage extends StatefulWidget {
@override
MapDesignPageState createState() => MapDesignPageState();
}
class MapDesignPageState extends State<MapDesignPage> {
Completer<GoogleMapController> _controller = Completer();
Future _data;
var riskList = [];
// String colomboRL = '0';
// var galleRL = '0';
//var ampareRL = '0';
String ampareRL = '0';
String anuradhapuraRL = '0';
String badullaRL = '0';
String batticaloaRL = '0';
String colomboRL = '0';
String galleRL = '0';
String gampahaRL = '0';
String hambantotaRL = '0';
String jaffnaRL = '0';
String kalmunaiRL = '0';
String kalutaraRL = '0';
String kandyRL = '0';
String kegalleRL = '0';
String kilinochchiRL = '0';
String kurunagalaRL = '0';
String mannarRL = '0';
String mataleRL = '0';
String mataraRL = '0';
String monaragalaRL = '0';
String mullaitivuRL = '0';
String nuwaraEliyaRL = '0';
String polonnaruwaRL = '0';
String puttalamRL = '0';
String ratnapuraRL = '0';
String trincomaleeRL = '0';
String vavuniyaRL = '0';
//Key mapKey = UniqueKey();
BitmapDescriptor colomboIcon = BitmapDescriptor.defaultMarkerWithHue(
BitmapDescriptor.hueRed,
);
/* Future _readData() async {
var firestore = Firestore.instance;
QuerySnapshot qn = await firestore.collection("RiskLevel").getDocuments();
print(qn.documents[0].data());
//print(qn.documents[1].data());
for (int no = 0; no < 26; no++) {
riskList.add(qn.documents[no].data());
}
print(riskList);
print('yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy');
print(riskList[17]);
}*/
@override
void initState() {
super.initState();
_data = _readData();
// print('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
}
final FirebaseFirestore firestore = FirebaseFirestore.instance;
Future _readData() async {
//DocumentReference documentReference = Firestore.instance.collection("RiskLocation").document('');
DocumentSnapshot documentSnapshot;
try {
/* documentSnapshot = await firestore
.collection('RiskLevel')
.document('Gampaha_2021-06-30')
.get();*/
documentSnapshot =
// ignore: missing_return
await firestore
.collection("RiskLevel")
.orderBy("date", descending: true)
.get()
// ignore: missing_return
.then((querySnapshot) {
querySnapshot.docs.forEach((result) {
print(result.data());
setState(() {
riskList.add(result.data());
});
// print(querySnapshot.docs);
// print(querySnapshot.docs[0]);
});
// print(riskList[4]);
//print('ddddddddddddddddddddddddddddddddddddddddddddddddddddddd');
print(riskList);
// return documentSnapshot;
});
/* print('documentSnapshot.data.toString()');
print(documentSnapshot.data.toString());
print(documentSnapshot.get('cases'));
print(documentSnapshot.data()['riskLevel']);*/
// print(documentSnapshot);
} catch (e) {
print(e);
}
}
double zoomVal = 5.0;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backwardsCompatibility: false,
backgroundColor: Colors.blueAccent.shade700,
title: Text("Sri Lanka"),
),
body: Stack(
children: <Widget>[
_buildContainer(),
_buildGoogleMap(context),
_zoomminusfunction(),
_zoomplusfunction(),
_buildContainer(),
],
),
);
}
Widget _zoomminusfunction() {
return Align(
alignment: Alignment.topLeft,
child: IconButton(
icon: Icon(FontAwesomeIcons.searchMinus, color: Color(0xff6200ee)),
onPressed: () {
zoomVal--;
_minus(zoomVal);
}),
);
}
Widget _zoomplusfunction() {
return Align(
alignment: Alignment.topRight,
child: IconButton(
icon: Icon(FontAwesomeIcons.searchPlus, color: Color(0xff6200ee)),
onPressed: () {
zoomVal++;
_plus(zoomVal);
}),
);
}
Future<void> _minus(double zoomVal) async {
final GoogleMapController controller = await _controller.future;
controller.animateCamera(CameraUpdate.newCameraPosition(
CameraPosition(target: LatLng(7.8731, 80.7718), zoom: zoomVal)));
}
Future<void> _plus(double zoomVal) async {
final GoogleMapController controller = await _controller.future;
controller.animateCamera(CameraUpdate.newCameraPosition(
CameraPosition(target: LatLng(7.8731, 80.7718), zoom: zoomVal)));
}
var name = [];
Widget _buildContainer() {
return Align(
alignment: Alignment.bottomLeft,
child: Container(
margin: EdgeInsets.symmetric(vertical: 20.0),
height: 150.0,
child: ListView(
scrollDirection: Axis.horizontal,
children: <Widget>[
SizedBox(width: 9.0),
Padding(
padding: const EdgeInsets.all(8.0),
child: _boxes(
"https://media-cdn.tripadvisor.com/media/photo-s/05/c0/c0/b1/buddhangala-monastery.jpg",
7.3018,
81.6747,
"Ampara",
riskList.isEmpty
? {
'date': '',
'district': '',
'riskLevel': '',
'cases': ''
}
: riskList[25])),
SizedBox(width: 9.0),
Padding(
padding: const EdgeInsets.all(8.0),
child: _boxes(
"https://www.beautifulday.photography/img/s/v-10/p2915189545-3.jpg",
8.3114,
80.4037,
"Anuradhapura",
riskList.isEmpty
? {
'date': '',
'district': '',
'riskLevel': '',
'cases': ''
}
: riskList[24]),
),
SizedBox(width: 9.0),
Padding(
padding: const EdgeInsets.all(8.0),
child: _boxes(
"https://media-cdn.tripadvisor.com/media/photo-s/17/0b/d7/e7/dunhinda-falls-is-a-waterfall.jpg",
6.9934,
81.0550,
"Badulla",
riskList.isEmpty
? {
'date': '',
'district': '',
'riskLevel': '',
'cases': ''
}
: riskList[23]),
),
SizedBox(width: 9.0),
Padding(
padding: const EdgeInsets.all(8.0),
child: _boxes(
"https://www.lovesrilanka.org/wp-content/uploads/2020/04/LS_BLOG27_C1_800x520.jpg",
7.7310,
81.6747,
"Batticaloa",
riskList.isEmpty
? {
'date': '',
'district': '',
'riskLevel': '',
'cases': ''
}
: riskList[22]),
),
SizedBox(width: 9.0),
Padding(
padding: const EdgeInsets.all(8.0),
child: _boxes(
"https://sprudge.com/wp-content/uploads/2020/01/colombo-sklyine-4-Colombo.jpg",
6.9271,
79.8612,
"Colombo",
riskList.isEmpty
? {
'date': '',
'district': '',
'riskLevel': '',
'cases': ''
}
: riskList[21]),
),
SizedBox(width: 9.0),
Padding(
padding: const EdgeInsets.all(8.0),
child: _boxes(
"https://img.traveltriangle.com/blog/wp-content/uploads/2019/08/shutterstock_599364767.jpg",
6.0535,
80.2210,
"Galle",
riskList.isEmpty
? {
'date': '',
'district': '',
'riskLevel': '',
'cases': ''
}
: riskList[20]),
),
SizedBox(width: 9.0),
Padding(
padding: const EdgeInsets.all(8.0),
child: _boxes(
"https://upload.wikimedia.org/wikipedia/commons/thumb/0/08/PSX_20190611_112013.jpg/1200px-PSX_20190611_112013.jpg",
7.0840,
80.0098,
"Gampaha",
riskList.isEmpty
? {
'date': '',
'district': '',
'riskLevel': '',
'cases': ''
}
: riskList[19]),
),
SizedBox(width: 9.0),
Padding(
padding: const EdgeInsets.all(8.0),
child: _boxes(
"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQJ0N-JsypZJa5bVi-YRGn8wbVf7ehzvu0NvQ&usqp=CAU",
6.1429,
81.1212,
"Hambantota",
riskList.isEmpty
? {
'date': '',
'district': '',
'riskLevel': '',
'cases': ''
}
: riskList[18]),
),
SizedBox(width: 9.0),
Padding(
padding: const EdgeInsets.all(8.0),
child: _boxes(
"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTFvNDtyFYB52eUau9Xpt95Go1oiXSxYdK87A&usqp=CAU",
9.6615,
80.0255,
"Jaffna",
riskList.isEmpty
? {
'date': '',
'district': '',
'riskLevel': '',
'cases': ''
}
: riskList[17]),
),
SizedBox(width: 9.0),
Padding(
padding: const EdgeInsets.all(8.0),
child: _boxes(
"https://www.holidify.com/images/bgImages/KALMUNAI.jpg",
7.4144,
81.8306,
"Kalmunai",
riskList.isEmpty
? {
'date': '',
'district': '',
'riskLevel': '',
'cases': ''
}
: riskList[16]),
),
SizedBox(width: 9.0),
Padding(
padding: const EdgeInsets.all(8.0),
child: _boxes(
"https://i.pinimg.com/originals/30/ab/6b/30ab6b2a15b944a94c2947a7eaa6d077.jpg",
6.5854,
79.9607,
"Kalutara",
riskList.isEmpty
? {
'date': '',
'district': '',
'riskLevel': '',
'cases': ''
}
: riskList[15]),
),
SizedBox(width: 9.0),
Padding(
padding: const EdgeInsets.all(8.0),
child: _boxes(
"https://deih43ym53wif.cloudfront.net/temple-tooth-kandy-sri-lanka-shutterstock_1037797372_24beb3388c.jpeg",
7.2906,
80.6337,
"Kandy",
riskList.isEmpty
? {
'date': '',
'district': '',
'riskLevel': '',
'cases': ''
}
: riskList[14]),
),
SizedBox(width: 9.0),
Padding(
padding: const EdgeInsets.all(8.0),
child: _boxes(
"https://tour.lk/uploads/image-slider-1_aZyGzTVf8m.jpg",
7.2513,
80.3464,
"Kegalle",
riskList.isEmpty
? {
'date': '',
'district': '',
'riskLevel': '',
'cases': ''
}
: riskList[13]),
),
SizedBox(width: 9.0),
Padding(
padding: const EdgeInsets.all(8.0),
child: _boxes(
"https://a0.muscache.com/im/pictures/4d03103e-be4e-4f98-b3cb-2c93cc3e5a69.jpg?im_w=720",
9.3803,
80.3770,
"Kilinochchi",
riskList.isEmpty
? {
'date': '',
'district': '',
'riskLevel': '',
'cases': ''
}
: riskList[12]),
),
SizedBox(width: 9.0),
Padding(
padding: const EdgeInsets.all(8.0),
child: _boxes(
"https://lh3.googleusercontent.com/proxy/4lJEUjq8w-sw_LooTY1bHG63rMZYlKKkusbahIx4048TcY-VBxRlkykpKBvLrcWUxaQA655UqKhzrkQcGfZZ_0S_X8SzFbJL2iqMLr_DS_Rgict2lWsDsT4fe86x6BrA",
7.4818,
80.3609,
"Kurunagala",
riskList.isEmpty
? {
'date': '',
'district': '',
'riskLevel': '',
'cases': ''
}
: riskList[11]),
),
SizedBox(width: 9.0),
Padding(
padding: const EdgeInsets.all(8.0),
child: _boxes(
"http://2.bp.blogspot.com/-nkNGsHbUmO4/UdeIWeUQ2eI/AAAAAAAAAFY/vg_kz4inal8/s1600/Adam_Bridge.jpg",
8.9810,
79.9044,
"Mannar",
riskList.isEmpty
? {
'date': '',
'district': '',
'riskLevel': '',
'cases': ''
}
: riskList[10]),
),
SizedBox(width: 9.0),
Padding(
padding: const EdgeInsets.all(8.0),
child: _boxes(
"https://i.pinimg.com/originals/d4/f5/7a/d4f57a953657679491b8c0a9b17e6b67.jpg",
7.4675,
80.6234,
"Matale",
riskList.isEmpty
? {
'date': '',
'district': '',
'riskLevel': '',
'cases': ''
}
: riskList[9]),
),
SizedBox(width: 9.0),
Padding(
padding: const EdgeInsets.all(8.0),
child: _boxes(
"https://i.ytimg.com/vi/cXKMMjWifaw/maxresdefault.jpg",
5.9549,
80.5550,
"Matara",
riskList.isEmpty
? {
'date': '',
'district': '',
'riskLevel': '',
'cases': ''
}
: riskList[8]),
),
SizedBox(width: 9.0),
Padding(
padding: const EdgeInsets.all(8.0),
child: _boxes(
"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTnyn8Nbn1UAF2lgZhmPiraxdcSrOmGGZXR45sTFVToZsdQ80FTQXB8XaMvxD3T6lEkm0s&usqp=CAU",
6.8728,
81.3507,
"Monaragala",
riskList.isEmpty
? {
'date': '',
'district': '',
'riskLevel': '',
'cases': ''
}
: riskList[7]),
),
SizedBox(width: 9.0),
Padding(
padding: const EdgeInsets.all(8.0),
child: _boxes(
"https://tour.lk/uploads/image-slider-15sad_PJbiME6ty3.jpg",
9.2671,
80.8142,
"Mullaitivu",
riskList.isEmpty
? {
'date': '',
'district': '',
'riskLevel': '',
'cases': ''
}
: riskList[6]),
),
SizedBox(width: 9.0),
Padding(
padding: const EdgeInsets.all(8.0),
child: _boxes(
"https://hare-media-cdn.tripadvisor.com/media/attractions-splice-spp-674x446/07/7b/c0/1e.jpg",
6.9497,
80.7891,
"Nuwara Eliya",
riskList.isEmpty
? {
'date': '',
'district': '',
'riskLevel': '',
'cases': ''
}
: riskList[5]),
),
SizedBox(width: 9.0),
Padding(
padding: const EdgeInsets.all(8.0),
child: _boxes(
"https://www.destguides.com/dynamic-files/itinerarystop/5722/background-image.jpg",
7.9403,
81.0188,
"Polonnaruwa",
riskList.isEmpty
? {
'date': '',
'district': '',
'riskLevel': '',
'cases': ''
}
: riskList[4]),
),
SizedBox(width: 9.0),
Padding(
padding: const EdgeInsets.all(8.0),
child: _boxes(
"https://d27k8xmh3cuzik.cloudfront.net/wp-content/uploads/2019/01/OG-Puttalam-Places-To-Visitepb0310.jpg",
8.0408,
79.8394,
"Puttalam",
riskList.isEmpty
? {
'date': '',
'district': '',
'riskLevel': '',
'cases': ''
}
: riskList[3]),
),
SizedBox(width: 9.0),
Padding(
padding: const EdgeInsets.all(8.0),
child: _boxes(
"https://media.timeout.com/images/102153093/630/472/image.jpg",
6.7056,
80.3847,
"Ratnapura",
riskList.isEmpty
? {
'date': '',
'district': '',
'riskLevel': '',
'cases': ''
}
: riskList[2]),
),
SizedBox(width: 9.0),
Padding(
padding: const EdgeInsets.all(8.0),
child: _boxes(
"https://tuktukdude.com/wp-content/uploads/2019/07/shutterstock_597005744-e1515476269187-1-2000x1500.jpg",
8.5874,
81.2152,
"Trincomalee",
riskList.isEmpty
? {
'date': '',
'district': '',
'riskLevel': '',
'cases': ''
}
: riskList[1]),
),
SizedBox(width: 9.0),
Padding(
padding: const EdgeInsets.all(8.0),
child: _boxes(
"https://d27k8xmh3cuzik.cloudfront.net/wp-content/uploads/2014/11/og-for-Places-To-Visit-In-Vavuniya.jpg",
8.7542,
80.4982,
"Vavuniya",
riskList.isEmpty
? {
'date': '',
'district': '',
'riskLevel': '',
'cases': ''
}
: riskList[0]),
),
],
),
),
);
}
Widget _boxes(String _image, double lat, double long, String districtName,
Object data) {
return GestureDetector(
onTap: () {
// mapKey = UniqueKey();
_gotoLocation(lat, long);
},
child: Container(
child: new FittedBox(
child: Material(
color: Colors.white,
elevation: 14.0,
borderRadius: BorderRadius.circular(24.0),
shadowColor: Color(0x802196F3),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Container(
width: 180,
height: 200,
child: ClipRRect(
borderRadius: new BorderRadius.circular(24.0),
child: Image(
fit: BoxFit.fill,
image: NetworkImage(_image),
),
),
),
Container(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: cardInfoContainer(districtName, data),
),
),
],
)),
),
),
);
}
Widget cardInfoContainer(String districtName, Object data) {
// print("........................................................");
var rlevel = "";
var map = Map<String, dynamic>.from(data);
if (map['riskLevel'].toString() == '0' &&
map['riskLevel'].toString().isNotEmpty) {
rlevel = 'Risk of COVID19 is low';
}
if (map['riskLevel'].toString() == '1' &&
map['riskLevel'].toString().isNotEmpty) {
rlevel = 'Risk of COVID19 is avarage';
}
if (map['riskLevel'].toString() == '2' &&
map['riskLevel'].toString().isNotEmpty) {
rlevel = 'Risk of COVID19 is high';
}
if (map['riskLevel'].toString() != "") {
switch (map['district']) {
case 'ampara':
print("=========== Switch :" + map['riskLevel'].toString());
setState(() {
// mapKey = UniqueKey();
ampareRL = map['riskLevel'].toString();
});
break;
case 'anuradhapura':
setState(() {
// mapKey = UniqueKey();
anuradhapuraRL = map['riskLevel'];
});
break;
case 'badulla':
setState(() {
// mapKey = UniqueKey();
badullaRL = map['riskLevel'];
});
break;
case 'batticaloa':
setState(() {
// mapKey = UniqueKey();
batticaloaRL = map['riskLevel'].toString();
});
break;
case 'colombo':
setState(() {
// mapKey = UniqueKey();
colomboRL = map['riskLevel'];
});
break;
case 'galle':
setState(() {
// mapKey = UniqueKey();
galleRL = map['riskLevel'];
});
break;
case 'gampaha':
setState(() {
//mapKey = UniqueKey();
gampahaRL = map['riskLevel'].toString();
});
break;
case 'hambantota':
setState(() {
// mapKey = UniqueKey();
hambantotaRL = map['riskLevel'];
});
break;
case 'jaffna':
setState(() {
// mapKey = UniqueKey();
jaffnaRL = map['riskLevel'];
});
break;
case 'kalmunai':
setState(() {
// mapKey = UniqueKey();
kalmunaiRL = map['riskLevel'].toString();
});
break;
case 'kalutara':
setState(() {
// mapKey = UniqueKey();
kalutaraRL = map['riskLevel'];
});
break;
case 'kandy':
setState(() {
// mapKey = UniqueKey();
kandyRL = map['riskLevel'];
});
break;
case 'kegalle':
setState(() {
// mapKey = UniqueKey();
kegalleRL = map['riskLevel'].toString();
});
break;
case 'kilinochchi':
setState(() {
// mapKey = UniqueKey();
kilinochchiRL = map['riskLevel'];
});
break;
case 'kurunagala':
setState(() {
// mapKey = UniqueKey();
kurunagalaRL = map['riskLevel'];
});
break;
case 'mannar':
setState(() {
// mapKey = UniqueKey();
mannarRL = map['riskLevel'].toString();
});
break;
case 'matale':
setState(() {
// mapKey = UniqueKey();
mataleRL = map['riskLevel'];
});
break;
case 'matara':
setState(() {
// mapKey = UniqueKey();
mataraRL = map['riskLevel'];
});
break;
case 'monaragala':
setState(() {
// mapKey = UniqueKey();
monaragalaRL = map['riskLevel'].toString();
});
break;
case 'mullaitivu':
setState(() {
// mapKey = UniqueKey();
mullaitivuRL = map['riskLevel'];
});
break;
case 'nuwaraEliya':
setState(() {
// mapKey = UniqueKey();
nuwaraEliyaRL = map['riskLevel'];
});
break;
case 'polonnaruwa':
setState(() {
// mapKey = UniqueKey();
polonnaruwaRL = map['riskLevel'].toString();
});
break;
case 'puttalam':
setState(() {
// mapKey = UniqueKey();
puttalamRL = map['riskLevel'];
});
break;
case 'ratnapura':
setState(() {
// mapKey = UniqueKey();
ratnapuraRL = map['riskLevel'];
});
break;
case 'trincomalee':
setState(() {
// mapKey = UniqueKey();
trincomaleeRL = map['riskLevel'].toString();
});
break;
case 'vavuniya':
setState(() {
// mapKey = UniqueKey();
vavuniyaRL = map['riskLevel'];
});
break;
}
}
//print(map["date"]);
return Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Container(
child: Icon(
FontAwesomeIcons.heartbeat,
color: Colors.red,
size: 15.0,
),
),
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: Container(
child: Text(
districtName,
style: TextStyle(
color: Color(0xff6200ee),
fontSize: 24.0,
fontWeight: FontWeight.bold),
)),
),
SizedBox(height: 5.0),
Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Container(
child: Text(
"Date : " + map['date'].toString() == ""
? " "
: map['date'].toString(),
style: TextStyle(
color: Colors.black54,
fontSize: 18.0,
),
)),
],
)),
SizedBox(height: 5.0),
Container(
child: Text(
"Cases during week \u00B7\u00B7 " + map['cases'].toString() == ""
? " "
: "Reported cases during week : " + map['cases'].toString(),
style: TextStyle(
color: Colors.black54,
fontSize: 18.0,
),
)),
SizedBox(height: 5.0),
Container(
child: Text(
rlevel + "\u00B7 Stay safe",
style: TextStyle(
color: Colors.black54,
fontSize: 18.0,
fontWeight: FontWeight.bold),
)),
],
);
}
Widget _buildGoogleMap(BuildContext context) {
return Container(
// key: mapKey,
height: MediaQuery.of(context).size.height,
width: MediaQuery.of(context).size.width,
child: GoogleMap(
mapType: MapType.normal,
initialCameraPosition:
CameraPosition(target: LatLng(7.8731, 80.7718), zoom: 7),
onMapCreated: (GoogleMapController controller) {
_controller.complete(controller);
},
///////////////
/////////////////
markers: {
ampara(ampareRL),
anuradhapura(anuradhapuraRL),
badulla(badullaRL),
batticaloa(batticaloaRL),
colombo(colomboRL),
galle(galleRL),
gampaha(gampahaRL),
hambantota(hambantotaRL),
jaffna(jaffnaRL),
kalmunai(kalmunaiRL),
kalutara(kalutaraRL),
kandy(kandyRL),
kegalle(kegalleRL),
kilinochchi(kilinochchiRL),
kurunagala(kurunagalaRL),
mannar(mannarRL),
matale(mataleRL),
matara(mataraRL),
monaragala(monaragalaRL),
mullaitivu(mullaitivuRL),
nuwaraEliya(nuwaraEliyaRL),
polonnaruwa(polonnaruwaRL),
puttalam(puttalamRL),
ratnapura(ratnapuraRL),
trincomalee(trincomaleeRL),
vavuniya(vavuniyaRL),
},
),
);
}
Future<void> _gotoLocation(double lat, double long) async {
final GoogleMapController controller = await _controller.future;
controller.animateCamera(CameraUpdate.newCameraPosition(CameraPosition(
target: LatLng(lat, long),
zoom: 10,
tilt: 50.0,
bearing: 45.0,
)));
}
////////////////
///////////////
Marker ampara(String level) {
return Marker(
markerId: MarkerId('ampara'),
position: LatLng(7.3018, 81.6747),
infoWindow: InfoWindow(title: 'ampara'),
icon: BitmapDescriptor.defaultMarkerWithHue(
// BitmapDescriptor.hueRed,
(level == "0")
? BitmapDescriptor.hueGreen
: (level == "1")
? BitmapDescriptor.hueOrange
: BitmapDescriptor.hueRed),
);
}
Marker anuradhapura(String level) {
return Marker(
markerId: MarkerId('anuradhapura'),
position: LatLng(8.3114, 80.4037),
infoWindow: InfoWindow(title: 'anuradhapura'),
icon: BitmapDescriptor.defaultMarkerWithHue(
// BitmapDescriptor.hueRed,
(level == "0")
? BitmapDescriptor.hueGreen
: (level == "1")
? BitmapDescriptor.hueOrange
: BitmapDescriptor.hueRed),
);
}
Marker badulla(String level) {
return Marker(
markerId: MarkerId('badulla'),
position: LatLng(6.9934, 81.0550),
infoWindow: InfoWindow(title: 'badulla'),
icon: BitmapDescriptor.defaultMarkerWithHue(
// BitmapDescriptor.hueRed,
(level == "0")
? BitmapDescriptor.hueGreen
: (level == "1")
? BitmapDescriptor.hueOrange
: BitmapDescriptor.hueRed),
);
}
Marker batticaloa(String level) {
return Marker(
markerId: MarkerId('batticaloa'),
position: LatLng(7.7310, 81.6747),
infoWindow: InfoWindow(title: 'batticaloa'),
icon: BitmapDescriptor.defaultMarkerWithHue(
// BitmapDescriptor.hueRed,
(level == "0")
? BitmapDescriptor.hueGreen
: (level == "1")
? BitmapDescriptor.hueOrange
: BitmapDescriptor.hueRed),
);
}
Marker colombo(String level) {
print("========= Function : " + level);
return Marker(
markerId: MarkerId('colombo'),
position: LatLng(6.9271, 79.8612),
infoWindow: InfoWindow(title: 'colombo'),
icon: BitmapDescriptor.defaultMarkerWithHue(
// BitmapDescriptor.hueRed,
(level == "0")
? BitmapDescriptor.hueGreen
: (level == "1")
? BitmapDescriptor.hueOrange
: BitmapDescriptor.hueRed),
);
}
Marker galle(String level) {
return Marker(
markerId: MarkerId('galle'),
position: LatLng(6.0535, 80.2210),
infoWindow: InfoWindow(title: 'galle'),
icon: BitmapDescriptor.defaultMarkerWithHue(
// BitmapDescriptor.hueRed,
(level == "0")
? BitmapDescriptor.hueGreen
: (level == "1")
? BitmapDescriptor.hueOrange
: BitmapDescriptor.hueRed),
);
}
Marker gampaha(String level) {
return Marker(
markerId: MarkerId('gampaha'),
position: LatLng(7.0840, 80.0098),
infoWindow: InfoWindow(title: 'gampaha'),
icon: BitmapDescriptor.defaultMarkerWithHue(
// BitmapDescriptor.hueRed,
(level == "0")
? BitmapDescriptor.hueGreen
: (level == "1")
? BitmapDescriptor.hueOrange
: BitmapDescriptor.hueRed),
);
}
Marker hambantota(String level) {
return Marker(
markerId: MarkerId('hambantota'),
position: LatLng(6.1429, 81.1212),
infoWindow: InfoWindow(title: 'hambantota'),
icon: BitmapDescriptor.defaultMarkerWithHue(
// BitmapDescriptor.hueRed,
(level == "0")
? BitmapDescriptor.hueGreen
: (level == "1")
? BitmapDescriptor.hueOrange
: BitmapDescriptor.hueRed),
);
}
Marker jaffna(String level) {
return Marker(
markerId: MarkerId('jaffna'),
position: LatLng(9.6615, 80.0255),
infoWindow: InfoWindow(title: 'jaffna'),
icon: BitmapDescriptor.defaultMarkerWithHue(
// BitmapDescriptor.hueRed,
(level == "0")
? BitmapDescriptor.hueGreen
: (level == "1")
? BitmapDescriptor.hueOrange
: BitmapDescriptor.hueRed),
);
}
Marker kalmunai(String level) {
return Marker(
markerId: MarkerId('kalmunai'),
position: LatLng(7.4144, 81.8306),
infoWindow: InfoWindow(title: 'kalmunai'),
icon: BitmapDescriptor.defaultMarkerWithHue(
// BitmapDescriptor.hueRed,
(level == "0")
? BitmapDescriptor.hueGreen
: (level == "1")
? BitmapDescriptor.hueOrange
: BitmapDescriptor.hueRed),
);
}
Marker kalutara(String level) {
return Marker(
markerId: MarkerId('kalutara'),
position: LatLng(6.5854, 79.9607),
infoWindow: InfoWindow(title: 'kalutara'),
icon: BitmapDescriptor.defaultMarkerWithHue(
// BitmapDescriptor.hueRed,
(level == "0")
? BitmapDescriptor.hueGreen
: (level == "1")
? BitmapDescriptor.hueOrange
: BitmapDescriptor.hueRed),
);
}
Marker kandy(String level) {
return Marker(
markerId: MarkerId('kandy'),
position: LatLng(7.2906, 80.6337),
infoWindow: InfoWindow(title: 'kandy'),
icon: BitmapDescriptor.defaultMarkerWithHue(
// BitmapDescriptor.hueRed,
(level == "0")
? BitmapDescriptor.hueGreen
: (level == "1")
? BitmapDescriptor.hueOrange
: BitmapDescriptor.hueRed),
);
}
Marker kegalle(String level) {
return Marker(
markerId: MarkerId('kegalle'),
position: LatLng(7.2513, 80.3464),
infoWindow: InfoWindow(title: 'kegalle'),
icon: BitmapDescriptor.defaultMarkerWithHue(
// BitmapDescriptor.hueRed,
(level == "0")
? BitmapDescriptor.hueGreen
: (level == "1")
? BitmapDescriptor.hueOrange
: BitmapDescriptor.hueRed),
);
}
Marker kilinochchi(String level) {
return Marker(
markerId: MarkerId('kilinochchi'),
position: LatLng(9.3803, 80.3770),
infoWindow: InfoWindow(title: 'kilinochchi'),
icon: BitmapDescriptor.defaultMarkerWithHue(
// BitmapDescriptor.hueRed,
(level == "0")
? BitmapDescriptor.hueGreen
: (level == "1")
? BitmapDescriptor.hueOrange
: BitmapDescriptor.hueRed),
);
}
Marker kurunagala(String level) {
return Marker(
markerId: MarkerId('kurunagala'),
position: LatLng(7.4818, 80.3609),
infoWindow: InfoWindow(title: 'kurunagala'),
icon: BitmapDescriptor.defaultMarkerWithHue(
// BitmapDescriptor.hueRed,
(level == "0")
? BitmapDescriptor.hueGreen
: (level == "1")
? BitmapDescriptor.hueOrange
: BitmapDescriptor.hueRed),
);
}
Marker mannar(String level) {
return Marker(
markerId: MarkerId('mannar'),
position: LatLng(8.9810, 79.9044),
infoWindow: InfoWindow(title: 'mannar'),
icon: BitmapDescriptor.defaultMarkerWithHue(
// BitmapDescriptor.hueRed,
(level == "0")
? BitmapDescriptor.hueGreen
: (level == "1")
? BitmapDescriptor.hueOrange
: BitmapDescriptor.hueRed),
);
}
Marker matale(String level) {
return Marker(
markerId: MarkerId('matale'),
position: LatLng(7.4675, 80.6234),
infoWindow: InfoWindow(title: 'matale'),
icon: BitmapDescriptor.defaultMarkerWithHue(
// BitmapDescriptor.hueRed,
(level == "0")
? BitmapDescriptor.hueGreen
: (level == "1")
? BitmapDescriptor.hueOrange
: BitmapDescriptor.hueRed),
);
}
Marker matara(String level) {
return Marker(
markerId: MarkerId('matara'),
position: LatLng(5.9549, 80.5550),
infoWindow: InfoWindow(title: 'Matara'),
icon: BitmapDescriptor.defaultMarkerWithHue(
// BitmapDescriptor.hueRed,
(level == "0")
? BitmapDescriptor.hueGreen
: (level == "1")
? BitmapDescriptor.hueOrange
: BitmapDescriptor.hueRed),
);
}
Marker monaragala(String level) {
return Marker(
markerId: MarkerId('monaragala'),
position: LatLng(6.8728, 81.3507),
infoWindow: InfoWindow(title: 'monaragala'),
icon: BitmapDescriptor.defaultMarkerWithHue(
// BitmapDescriptor.hueRed,
(level == "0")
? BitmapDescriptor.hueGreen
: (level == "1")
? BitmapDescriptor.hueOrange
: BitmapDescriptor.hueRed),
);
}
Marker mullaitivu(String level) {
return Marker(
markerId: MarkerId('mullaitivu'),
position: LatLng(9.2671, 80.8142),
infoWindow: InfoWindow(title: 'mullaitivu'),
icon: BitmapDescriptor.defaultMarkerWithHue(
// BitmapDescriptor.hueRed,
(level == "0")
? BitmapDescriptor.hueGreen
: (level == "1")
? BitmapDescriptor.hueOrange
: BitmapDescriptor.hueRed),
);
}
Marker nuwaraEliya(String level) {
return Marker(
markerId: MarkerId('nuwaraEliya'),
position: LatLng(6.9497, 80.7891),
infoWindow: InfoWindow(title: 'nuwaraEliya'),
icon: BitmapDescriptor.defaultMarkerWithHue(
// BitmapDescriptor.hueRed,
(level == "0")
? BitmapDescriptor.hueGreen
: (level == "1")
? BitmapDescriptor.hueOrange
: BitmapDescriptor.hueRed),
);
}
Marker polonnaruwa(String level) {
return Marker(
markerId: MarkerId('polonnaruwa'),
position: LatLng(7.9403, 81.0188),
infoWindow: InfoWindow(title: 'polonnaruwa'),
icon: BitmapDescriptor.defaultMarkerWithHue(
// BitmapDescriptor.hueRed,
(level == "0")
? BitmapDescriptor.hueGreen
: (level == "1")
? BitmapDescriptor.hueOrange
: BitmapDescriptor.hueRed),
);
}
Marker puttalam(String level) {
return Marker(
markerId: MarkerId('puttalam'),
position: LatLng(8.0408, 79.8394),
infoWindow: InfoWindow(title: 'puttalam'),
icon: BitmapDescriptor.defaultMarkerWithHue(
// BitmapDescriptor.hueRed,
(level == "0")
? BitmapDescriptor.hueGreen
: (level == "1")
? BitmapDescriptor.hueOrange
: BitmapDescriptor.hueRed),
);
}
Marker ratnapura(String level) {
return Marker(
markerId: MarkerId('ratnapura'),
position: LatLng(6.7056, 80.3847),
infoWindow: InfoWindow(title: 'ratnapura'),
icon: BitmapDescriptor.defaultMarkerWithHue(
// BitmapDescriptor.hueRed,
(level == "0")
? BitmapDescriptor.hueGreen
: (level == "1")
? BitmapDescriptor.hueOrange
: BitmapDescriptor.hueRed),
);
}
Marker trincomalee(String level) {
return Marker(
markerId: MarkerId('trincomalee'),
position: LatLng(8.5874, 81.2152),
infoWindow: InfoWindow(title: 'trincomalee'),
icon: BitmapDescriptor.defaultMarkerWithHue(
// BitmapDescriptor.hueRed,
(level == "0")
? BitmapDescriptor.hueGreen
: (level == "1")
? BitmapDescriptor.hueOrange
: BitmapDescriptor.hueRed),
);
}
Marker vavuniya(String level) {
return Marker(
markerId: MarkerId('vavuniya'),
position: LatLng(8.7542, 80.4982),
infoWindow: InfoWindow(title: 'vavuniya'),
icon: BitmapDescriptor.defaultMarkerWithHue(
// BitmapDescriptor.hueRed,
(level == "0")
? BitmapDescriptor.hueGreen
: (level == "1")
? BitmapDescriptor.hueOrange
: BitmapDescriptor.hueRed),
);
}
}
import 'package:flutter/material.dart';
class CustomDialog extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Dialog(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16.0)),
elevation: 0.0,
backgroundColor: Colors.white,
child: dialogContent(context),
);
}
Widget dialogContent(BuildContext context) {
return Container(
margin: EdgeInsets.only(left: 0.0, right: 0.0),
child: Stack(
children: <Widget>[
Container(
margin: EdgeInsets.only(top: 13.0, right: 8.0),
decoration: BoxDecoration(
color: Colors.white,
shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(16.0),
boxShadow: <BoxShadow>[]),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
SizedBox(
height: 10.0,
),
Center(
child: Padding(
padding: const EdgeInsets.all(10.0),
child: new Text("Sorry please try \n again tomorrow",
style: TextStyle(fontSize: 10.0, color: Colors.black)),
) //
),
SizedBox(height: 14.0),
],
),
),
Positioned(
right: 0.0,
child: GestureDetector(
onTap: () {
Navigator.of(context).pop();
},
child: Align(
alignment: Alignment.topRight,
child: CircleAvatar(
radius: 14.0,
backgroundColor: Colors.white,
child: Icon(Icons.close, color: Colors.red),
),
),
),
),
],
),
);
}
}
import 'dart:ui';
import 'package:covidefender/SRouter/srouterDashboard.dart';
import 'package:covidefender/SRouter/widgets/alertDialogBox.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:covidefender/SRouter/secrectMapKey.dart'; // Stores the Google Maps API Key
import 'package:flutter_polyline_points/flutter_polyline_points.dart';
import 'package:geocoding/geocoding.dart';
import 'package:geolocator/geolocator.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import "dart:convert";
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'dart:math' show cos, sqrt, asin;
import 'package:quiver/iterables.dart';
class MapView extends StatefulWidget {
@override
_MapViewState createState() => _MapViewState();
}
class _MapViewState extends State<MapView> {
var districtDetails = [];
var docs = [];
Future _data;
var routine = [];
var routeRiskLevel;
var uniqueRoutine;
bool isItemFound = false;
final FirebaseFirestore firestore = FirebaseFirestore.instance;
Future _readData() async {
//DocumentReference documentReference = Firestore.instance.collection("RiskLocation").document('');
DocumentSnapshot documentSnapshot;
try {
/* documentSnapshot = await firestore
.collection('RiskLevel')
.document('Gampaha_2021-06-30')
.get();*/
documentSnapshot =
// ignore: missing_return
await firestore
.collection("RiskLevel")
.orderBy("date", descending: true)
.get()
// ignore: missing_return
.then((querySnapshot) {
querySnapshot.docs.forEach((result) {
// print(result.data());
setState(() {
districtDetails.add(result.data());
});
// print(querySnapshot.docs);
// print(querySnapshot.docs[0].data().values.elementAt(3));
});
//print(districtDetails);
print('ddddddddddddddddddddddddddddddddddddddddddddddddddddddd');
// print(riskList);
// return documentSnapshot;
});
/* print('documentSnapshot.data.toString()');
print(documentSnapshot.data.toString());
print(documentSnapshot.get('cases'));
print(documentSnapshot.data()['riskLevel']);*/
// print(documentSnapshot);
} catch (e) {
print(e);
}
}
CameraPosition _initialLocation =
CameraPosition(target: LatLng(7.8731, 80.7718), zoom: 7);
GoogleMapController mapController;
Position _currentPosition;
String _currentAddress = '';
final startAddressController = TextEditingController();
final destinationAddressController = TextEditingController();
final startAddressFocusNode = FocusNode();
final desrinationAddressFocusNode = FocusNode();
String _startAddress = '';
String _destinationAddress = '';
String _placeDistance;
Set<Marker> markers = {};
PolylinePoints polylinePoints;
Map<PolylineId, Polyline> polylines = {};
List<LatLng> polylineCoordinates = [];
final _scaffoldKey = GlobalKey<ScaffoldState>();
Widget _textField({
TextEditingController controller,
FocusNode focusNode,
String label,
String hint,
double width,
Icon prefixIcon,
Widget suffixIcon,
Function(String) locationCallback,
}) {
return Container(
width: width * 0.8,
child: TextField(
style: TextStyle(color: Colors.white),
onChanged: (value) {
locationCallback(value);
},
controller: controller,
focusNode: focusNode,
decoration: new InputDecoration(
prefixIcon: prefixIcon,
suffixIcon: suffixIcon,
labelText: label,
labelStyle: TextStyle(color: Colors.white70),
filled: true,
fillColor: Colors.white30,
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(
Radius.circular(10.0),
),
borderSide: BorderSide(
color: Colors.white,
width: 2,
),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(
Radius.circular(10.0),
),
borderSide: BorderSide(
color: Colors.white,
width: 2,
),
),
contentPadding: EdgeInsets.all(15),
hintText: hint,
hintStyle: TextStyle(color: Colors.white54)),
),
);
}
// Method for retrieving the current location
_getCurrentLocation() async {
print(
'999999999999999999999999999999999999999999999999999999999999999999999999999');
await Geolocator.getCurrentPosition(desiredAccuracy: LocationAccuracy.high)
.then((Position position) async {
setState(() {
_currentPosition = position;
print(
'999999999999999999999999999999999999999999999999999999999999999999999999999');
print('CURRENT POS: $_currentPosition');
mapController.animateCamera(
CameraUpdate.newCameraPosition(
CameraPosition(
target: LatLng(position.latitude, position.longitude),
zoom: 14.0,
),
),
);
});
await _getAddress();
}).catchError((e) {
print(e);
});
}
// Method for retrieving the address
_getAddress() async {
try {
List<Placemark> p = await placemarkFromCoordinates(
_currentPosition.latitude, _currentPosition.longitude);
Placemark place = p[0];
setState(() {
_currentAddress =
"${place.name}, ${place.locality}, ${place.postalCode}, ${place.country}";
startAddressController.text = _currentAddress;
_startAddress = _currentAddress;
});
} catch (e) {
print(e);
}
}
// Method for calculating the distance between two places
Future<bool> _calculateDistance() async {
try {
// Retrieving placemarks from addresses
List<Location> startPlacemark = await locationFromAddress(_startAddress);
List<Location> destinationPlacemark =
await locationFromAddress(_destinationAddress);
// Use the retrieved coordinates of the current position,
// instead of the address if the start position is user's
// current position, as it results in better accuracy.
double startLatitude = _startAddress == _currentAddress
? _currentPosition.latitude
: startPlacemark[0].latitude;
double startLongitude = _startAddress == _currentAddress
? _currentPosition.longitude
: startPlacemark[0].longitude;
double destinationLatitude = destinationPlacemark[0].latitude;
double destinationLongitude = destinationPlacemark[0].longitude;
String startCoordinatesString = '($startLatitude, $startLongitude)';
String destinationCoordinatesString =
'($destinationLatitude, $destinationLongitude)';
// Start Location Marker
Marker startMarker = Marker(
markerId: MarkerId(startCoordinatesString),
position: LatLng(startLatitude, startLongitude),
infoWindow: InfoWindow(
title: 'Start $startCoordinatesString',
snippet: _startAddress,
),
icon: BitmapDescriptor.defaultMarker,
);
// Destination Location Marker
Marker destinationMarker = Marker(
markerId: MarkerId(destinationCoordinatesString),
position: LatLng(destinationLatitude, destinationLongitude),
infoWindow: InfoWindow(
title: 'Destination $destinationCoordinatesString',
snippet: _destinationAddress,
),
icon: BitmapDescriptor.defaultMarker,
);
// Adding the markers to the list
markers.add(startMarker);
markers.add(destinationMarker);
print(
'START COORDINATES: ($startLatitude, $startLongitude)',
);
print(
'DESTINATION COORDINATES: ($destinationLatitude, $destinationLongitude)',
);
// Calculating to check that the position relative
// to the frame, and pan & zoom the camera accordingly.
double miny = (startLatitude <= destinationLatitude)
? startLatitude
: destinationLatitude;
double minx = (startLongitude <= destinationLongitude)
? startLongitude
: destinationLongitude;
double maxy = (startLatitude <= destinationLatitude)
? destinationLatitude
: startLatitude;
double maxx = (startLongitude <= destinationLongitude)
? destinationLongitude
: startLongitude;
double southWestLatitude = miny;
double southWestLongitude = minx;
double northEastLatitude = maxy;
double northEastLongitude = maxx;
// Accommodate the two locations within the
// camera view of the map
mapController.animateCamera(
CameraUpdate.newLatLngBounds(
LatLngBounds(
northeast: LatLng(northEastLatitude, northEastLongitude),
southwest: LatLng(southWestLatitude, southWestLongitude),
),
40.0,
),
);
// Calculating the distance between the start and the end positions
// with a straight path, without considering any route
// double distanceInMeters = await Geolocator.bearingBetween(
// startLatitude,
// startLongitude,
// destinationLatitude,
// destinationLongitude,
// );
await _createPolylines(startLatitude, startLongitude, destinationLatitude,
destinationLongitude);
double totalDistance = 0.0;
// Calculating the total distance by adding the distance
// between small segments
for (int i = 0; i < polylineCoordinates.length - 1; i++) {
totalDistance += _coordinateDistance(
polylineCoordinates[i].latitude,
polylineCoordinates[i].longitude,
polylineCoordinates[i + 1].latitude,
polylineCoordinates[i + 1].longitude,
);
}
setState(() {
_placeDistance = totalDistance.toStringAsFixed(2);
print('DISTANCE: $_placeDistance km');
});
return true;
} catch (e) {
print(e);
}
return false;
}
// Formula for calculating distance between two coordinates
// https://stackoverflow.com/a/54138876/11910277
double _coordinateDistance(lat1, lon1, lat2, lon2) {
var p = 0.017453292519943295;
var c = cos;
var a = 0.5 -
c((lat2 - lat1) * p) / 2 +
c(lat1 * p) * c(lat2 * p) * (1 - c((lon2 - lon1) * p)) / 2;
return 12742 * asin(sqrt(a));
}
// Create the polylines for showing the route between two places
_createPolylines(
double startLatitude,
double startLongitude,
double destinationLatitude,
double destinationLongitude,
) async {
print('77777777777777777777777777777777777777777777777777777777777');
print(districtDetails[21]['cases']);
print(
'ddddddddddddddddddddddddddddddvggggggggggggggggggggggggggggggggggggg');
var objList = [
{
'date': districtDetails[0]['date'],
'district': districtDetails[0]['district'],
'riskLevel': int.parse(districtDetails[0]['riskLevel']),
'cases': int.parse(districtDetails[0]['cases'])
},
{
'district': districtDetails[1]['district'],
'date': districtDetails[1]['date'],
'riskLevel': int.parse(districtDetails[1]['riskLevel']),
'cases': int.parse(districtDetails[1]['cases'])
},
{
'riskLevel': int.parse(districtDetails[2]['riskLevel']),
'district': districtDetails[2]['district'],
'date': districtDetails[2]['date'],
'cases': int.parse(districtDetails[2]['cases'])
},
{
'riskLevel': int.parse(districtDetails[3]['riskLevel']),
'district': districtDetails[3]['district'],
'date': districtDetails[3]['date'],
'cases': int.parse(districtDetails[3]['cases'])
},
{
'date': districtDetails[4]['date'],
'riskLevel': int.parse(districtDetails[4]['riskLevel']),
'district': districtDetails[4]['district'],
'cases': int.parse(districtDetails[4]['cases'])
},
{
'district': districtDetails[5]['district'],
'date': districtDetails[5]['date'],
'riskLevel': int.parse(districtDetails[5]['riskLevel']),
'cases': int.parse(districtDetails[5]['cases'])
},
{
'riskLevel': int.parse(districtDetails[6]['riskLevel']),
'date': districtDetails[6]['date'],
'district': districtDetails[6]['district'],
'cases': int.parse(districtDetails[6]['cases'])
},
{
'riskLevel': int.parse(districtDetails[7]['riskLevel']),
'date': districtDetails[7]['date'],
'district': districtDetails[7]['district'],
'cases': int.parse(districtDetails[7]['cases'])
},
{
'riskLevel': int.parse(districtDetails[8]['riskLevel']),
'date': districtDetails[8]['date'],
'district': districtDetails[8]['district'],
'cases': int.parse(districtDetails[8]['cases'])
},
{
'riskLevel': int.parse(districtDetails[9]['riskLevel']),
'date': districtDetails[9]['date'],
'district': districtDetails[9]['district'],
'cases': int.parse(districtDetails[9]['cases'])
},
{
'riskLevel': int.parse(districtDetails[10]['riskLevel']),
'date': districtDetails[10]['date'],
'district': districtDetails[10]['district'],
'cases': int.parse(districtDetails[10]['cases'])
},
{
'riskLevel': int.parse(districtDetails[11]['riskLevel']),
'date': districtDetails[11]['date'],
'district': districtDetails[11]['district'],
'cases': int.parse(districtDetails[11]['cases'])
},
{
'riskLevel': int.parse(districtDetails[12]['riskLevel']),
'date': districtDetails[12]['date'],
'district': districtDetails[12]['district'],
'cases': int.parse(districtDetails[12]['cases'])
},
{
'riskLevel': int.parse(districtDetails[13]['riskLevel']),
'date': districtDetails[13]['date'],
'district': districtDetails[13]['district'],
'cases': int.parse(districtDetails[13]['cases'])
},
{
'riskLevel': int.parse(districtDetails[14]['riskLevel']),
'date': districtDetails[14]['date'],
'district': districtDetails[14]['district'],
'cases': int.parse(districtDetails[14]['cases'])
},
{
'riskLevel': int.parse(districtDetails[15]['riskLevel']),
'district': districtDetails[15]['district'],
'date': districtDetails[15]['date'],
'cases': int.parse(districtDetails[15]['cases'])
},
{
'riskLevel': int.parse(districtDetails[16]['riskLevel']),
'district': districtDetails[16]['district'],
'date': districtDetails[16]['date'],
'cases': int.parse(districtDetails[16]['cases'])
},
{
'riskLevel': int.parse(districtDetails[17]['riskLevel']),
'district': districtDetails[17]['district'],
'date': districtDetails[17]['date'],
'cases': int.parse(districtDetails[17]['cases'])
},
{
'riskLevel': int.parse(districtDetails[18]['riskLevel']),
'district': districtDetails[18]['district'],
'date': districtDetails[18]['date'],
'cases': int.parse(districtDetails[18]['cases'])
},
{
'riskLevel': int.parse(districtDetails[19]['riskLevel']),
'district': districtDetails[19]['district'],
'date': districtDetails[19]['date'],
'cases': int.parse(districtDetails[19]['cases'])
},
{
'riskLevel': int.parse(districtDetails[20]['riskLevel']),
'district': districtDetails[20]['district'],
'date': districtDetails[20]['date'],
'cases': int.parse(districtDetails[20]['cases'])
},
{
'riskLevel': int.parse(districtDetails[21]['riskLevel']),
'district': districtDetails[21]['district'],
'date': districtDetails[21]['date'],
'cases': int.parse(districtDetails[21]['cases'])
},
{
'riskLevel': int.parse(districtDetails[22]['riskLevel']),
'district': districtDetails[22]['district'],
'date': districtDetails[22]['date'],
'cases': int.parse(districtDetails[22]['cases'])
},
{
'riskLevel': int.parse(districtDetails[23]['riskLevel']),
'district': districtDetails[23]['district'],
'date': districtDetails[23]['date'],
'cases': int.parse(districtDetails[23]['cases'])
},
{
'riskLevel': int.parse(districtDetails[24]['riskLevel']),
'district': districtDetails[24]['district'],
'date': districtDetails[24]['date'],
'cases': int.parse(districtDetails[24]['cases'])
},
{
'riskLevel': int.parse(districtDetails[25]['riskLevel']),
'district': districtDetails[25]['district'],
'date': districtDetails[25]['date'],
'cases': int.parse(districtDetails[25]['cases'])
}
];
var cordinatesLst = [
{'district': 'vavuniya', 'lat': 8.7, 'long': 80.4},
{'district': 'trincomalee', 'lat': 8.5, 'long': 81.2},
{'lat': 6.7, 'district': 'ratnapura', 'long': 80.3},
{'lat': 8.0, 'district': 'puttalam', 'long': 79.8},
{'lat': 7.9, 'district': 'polonnaruwa', 'long': 81.0},
{'district': 'nuwara eliya', 'lat': 6.9, 'long': 80.7},
{'lat': 9.2, 'district': 'mullaitivu', 'long': 80.8},
{'district': 'monaragala', 'lat': 6.87, 'long': 81.35},
{'lat': 5.9, 'district': 'matara', 'long': 80.5},
{'lat': 7.4, 'district': 'matale', 'long': 80.6},
{'lat': 8.9, 'district': 'mannar', 'long': 79.9},
{'lat': 7.4, 'district': 'kurunagala', 'long': 80.3},
{'district': 'kilinochchi', 'lat': 9.3, 'long': 80.3},
{'district': 'kegalle', 'lat': 7.2, 'long': 80.3},
{'district': 'kandy', 'lat': 7.2, 'long': 80.6},
{'lat': 6.5, 'district': 'kalutara', 'long': 79.9},
{'lat': 7.4, 'district': 'kalmunai', 'long': 81.8},
{'lat': 9.6, 'district': 'jaffna', 'long': 80.0},
{'district': 'hambantota', 'lat': 6.1, 'long': 81.1},
{'lat': 7.0, 'district': 'gampaha', 'long': 80.0},
{'lat': 6.0, 'district': 'galle', 'long': 80.2},
{'district': 'colombo', 'lat': 6.9, 'long': 79.9},
{'lat': 7.7, 'district': 'batticaloa', 'long': 81.6},
{'district': 'badulla', 'lat': 6.9, 'long': 81.0},
{'district': 'anuradhapura', 'lat': 8.3, 'long': 80.4},
{'district': 'ampara', 'lat': 7.3, 'long': 81.6}
];
final districtRisks = cordinatesLst.map((item) {
final risk = objList
.where((values) => values["district"] == item["district"])
.map((rl) => rl["riskLevel"] as int)
.first;
return item..["riskLevel"] = risk;
});
print(
'arr3_______________________________________________________________');
//print(districtRisks);
print(
'arr3_______________________________________________________________');
polylinePoints = PolylinePoints();
PolylineResult result = await polylinePoints.getRouteBetweenCoordinates(
SecrectMapKey.API_KEY, // Google Maps API Key
PointLatLng(startLatitude, startLongitude),
PointLatLng(destinationLatitude, destinationLongitude),
// travelMode: TravelMode.transit,
);
print(result.points);
// print(result.points.first);
print(
'ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss');
print(result.points.last);
var arr = [];
double getNumber(double input, {int precision = 2}) => double.parse(
'$input'.substring(0, '$input'.indexOf('.') + precision + 1));
result.points.forEach((element) {
arr.add({
'lat': getNumber(element.latitude, precision: 1),
'long': getNumber(element.longitude, precision: 1)
});
});
print(arr);
bool isNearlyEqual(var actual, var calculated) {
return (actual - calculated).abs() < 0.1;
}
final jsonList = arr.map((item) => jsonEncode(item)).toList();
final uniqueJsonList = jsonList.toSet().toList();
final results = uniqueJsonList.map((item) => jsonDecode(item)).toList();
//print(results);
print(
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
var a = [];
districtRisks.forEach((element) => {
results.forEach((e) => {
if ((element['lat'] == e['lat']) &&
isNearlyEqual(element['long'], e['long']))
// if ((element['lat'] == e['lat']) &&
// (element['long'] == e['long']))
{
//element.values.elementAt(3).toString(),
a.add(element.values.elementAt(3)),
print(element),
routine.add(element)
}
})
});
uniqueRoutine = routine.toSet().toList();
/* uniqueRoutine = routine.map((e) => e.id).toSet();
routine.retainWhere((x) => routine.remove(x.id));*/
print('eeeeeeeeeeeeeeeeeeeEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEeee');
print(uniqueRoutine);
print('eeeeeeeeeeeeeeeeeeeEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEeee');
//print(a);
print(a.reduce((curr, next) => curr > next ? curr : next));
routeRiskLevel = a.reduce((curr, next) => curr > next ? curr : next);
num sum = 0;
a.forEach((e) {
sum += e;
});
//routeRiskLevel = sum / a.length;
print(sum / a.length);
if (result.points.isNotEmpty) {
result.points.forEach((PointLatLng point) {
polylineCoordinates.add(LatLng(point.latitude, point.longitude));
});
}
PolylineId id = PolylineId('poly');
Polyline polyline = Polyline(
polylineId: id,
//color: Colors.red,
color: (routeRiskLevel == 0)
? Colors.green
: (routeRiskLevel == 1)
? Colors.orangeAccent
: Colors.red,
points: polylineCoordinates,
width: 3,
);
polylines[id] = polyline;
}
@override
void initState() {
super.initState();
_data = _readData();
// _getCurrentLocation();
}
@override
Widget build(BuildContext context) {
_deleteItem(var item) {
routine.remove(item);
setState(() {});
}
var height = MediaQuery.of(context).size.height;
var width = MediaQuery.of(context).size.width;
_showMaterialDialog() {
print(
'TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT');
print(routine[0]['riskLevel']);
showDialog(
context: context,
builder: (_) => new AlertDialog(
title: Container(
height: 70,
child: Column(
children: [
(routeRiskLevel == 0)
? new Text('This route has a low risk',
style: TextStyle(
fontSize: 15.0, color: Colors.green))
: (routeRiskLevel == 1)
? new Text('This route has a average risk',
style: TextStyle(
fontSize: 15.0, color: Colors.orange))
: new Text('This route has a high risk',
style: TextStyle(
fontSize: 15.0, color: Colors.red)),
new Text(
'Distance :' + ' ' + _placeDistance + ' ' + 'km',
style: TextStyle(
fontSize: 11.0,
color: Colors.blueAccent.shade700,
)),
(routeRiskLevel == 2)
? new Text('High Risk Area... ',
style:
TextStyle(fontSize: 14.0, color: Colors.red))
: new Text('No high risk area....',
style: TextStyle(
fontSize: 14.0, color: Colors.green)),
Container(
height: 17,
child: ListView.builder(
scrollDirection: Axis.horizontal,
padding: const EdgeInsets.all(0),
itemCount: uniqueRoutine.length,
itemBuilder: (BuildContext context, int index) {
return Container(
// height: 10,
padding: const EdgeInsets.all(0.0),
// // color: Colors.amber[colorCodes[index]],
child: Center(
child: (uniqueRoutine[index]['riskLevel'] ==
2)
? Text(
uniqueRoutine[index]['district'] +
' ' +
' ',
style: TextStyle(
fontSize: 14.0,
color: Colors.red.shade900))
: Container(),
));
}),
),
],
),
),
));
}
return Container(
height: height,
width: width,
child: Scaffold(
appBar: AppBar(
backwardsCompatibility: false,
backgroundColor: Colors.blueAccent.shade700,
title: Text("Find Route"),
),
key: _scaffoldKey,
body: Stack(
children: <Widget>[
// Map View
GoogleMap(
markers: Set<Marker>.from(markers),
initialCameraPosition: _initialLocation,
myLocationEnabled: true,
myLocationButtonEnabled: false,
mapType: MapType.normal,
zoomGesturesEnabled: true,
zoomControlsEnabled: false,
polylines: Set<Polyline>.of(polylines.values),
onMapCreated: (GoogleMapController controller) {
mapController = controller;
},
),
// Show zoom buttons
SafeArea(
child: Padding(
padding: const EdgeInsets.only(left: 10.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
ClipOval(
child: Material(
color: Colors.white, // button color
child: InkWell(
splashColor: Colors.blue, // inkwell color
child: SizedBox(
width: 40,
height: 40,
child: Icon(Icons.add),
),
onTap: () {
// _showMaterialDialog();
mapController.animateCamera(
CameraUpdate.zoomIn(),
);
},
),
),
),
SizedBox(height: 20),
ClipOval(
child: Material(
color: Colors.white, // button color
child: InkWell(
splashColor: Colors.blue, // inkwell color
child: SizedBox(
width: 40,
height: 40,
child: Icon(Icons.remove),
),
onTap: () {
mapController.animateCamera(
CameraUpdate.zoomOut(),
);
},
),
),
)
],
),
),
),
// Show the place input fields & button for
// showing the route
SafeArea(
child: Align(
alignment: Alignment.bottomCenter,
child: Padding(
padding: const EdgeInsets.only(top: 4.6),
child: Container(
decoration: BoxDecoration(
color: Colors.black45,
borderRadius: BorderRadius.all(
Radius.circular(20.0),
),
),
width: width * 0.8,
// height: height * 0.4,
child: Padding(
padding: const EdgeInsets.only(top: 5.0, bottom: 8.0),
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Text(
'Locations',
style:
TextStyle(fontSize: 18.0, color: Colors.white),
),
SizedBox(height: 1),
_textField(
label: 'Start',
hint: 'Choose starting point',
// Added this
prefixIcon:
Icon(Icons.looks_one, color: Colors.white70),
suffixIcon: IconButton(
icon: Icon(
Icons.my_location,
color: Colors.white,
),
onPressed: () {
_getCurrentLocation();
startAddressController.text = _currentAddress;
_startAddress = _currentAddress;
},
),
controller: startAddressController,
focusNode: startAddressFocusNode,
width: 300,
locationCallback: (String value) {
setState(() {
_startAddress = value;
});
}),
SizedBox(height: 10),
_textField(
label: 'Destination',
hint: 'Choose destination',
prefixIcon:
Icon(Icons.looks_two, color: Colors.white70),
controller: destinationAddressController,
focusNode: desrinationAddressFocusNode,
width: 300,
locationCallback: (String value) {
setState(() {
_destinationAddress = value;
});
}),
SizedBox(height: 2),
// Visibility(
// visible: _placeDistance == null ? false : true,
/* child: Text(
'DISTANCE: $_placeDistance km',
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
color: Colors.white,
),
),*/
// ),
SizedBox(height: 2),
ElevatedButton(
onPressed: (_startAddress != '' &&
_destinationAddress != '')
? () async {
startAddressFocusNode.unfocus();
desrinationAddressFocusNode.unfocus();
setState(() {
if (markers.isNotEmpty) markers.clear();
if (polylines.isNotEmpty)
polylines.clear();
if (polylineCoordinates.isNotEmpty)
polylineCoordinates.clear();
_placeDistance = null;
});
routine = [];
_calculateDistance().then((isCalculated) {
/* if (isCalculated) {
ScaffoldMessenger.of(context)
.showSnackBar(
SnackBar(
content: Text(
'Distance Calculated Sucessfully'),
),
);
} else {
ScaffoldMessenger.of(context)
.showSnackBar(
SnackBar(
content: Text(
'Error Calculating Distance'),
),
);
}*/
_showMaterialDialog();
});
// _showMaterialDialog();
}
: null,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
'Show Route'.toUpperCase(),
style: TextStyle(
color: Colors.white,
fontSize: 13.0,
),
),
),
style: ElevatedButton.styleFrom(
primary: Colors.red,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20.0),
),
),
),
],
),
),
),
),
),
),
// Show current location button
SafeArea(
child: Align(
alignment: Alignment.bottomRight,
child: Padding(
padding: const EdgeInsets.only(right: 10.0, bottom: 10.0),
child: ClipOval(
child: Material(
color: Colors.orange.shade100, // button color
child: InkWell(
splashColor: Colors.orange, // inkwell color
child: SizedBox(
width: 56,
height: 56,
child: Icon(Icons.my_location),
),
onTap: () {
_getCurrentLocation();
mapController.animateCamera(
CameraUpdate.newCameraPosition(
CameraPosition(
target: LatLng(
_currentPosition.latitude,
_currentPosition.longitude,
),
zoom: 18.0,
),
),
);
},
),
),
),
),
),
),
],
),
),
);
}
}
class SecrectMapKey {
// Add your Google Maps API Key here
static const API_KEY = 'AIzaSyBuDih9ioyQAR9ikg3zEoE_5mhXvZh5oAw';
}
import 'package:flutter/material.dart';
import 'MapDesignPage.dart';
import 'safeRoute.dart';
import 'dialogbox.dart';
class SrouterDashboard extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backwardsCompatibility: false,
backgroundColor: Colors.blueAccent.shade700,
title: Text("SRouter Map"),
),
body: Stack(
children: <Widget>[
Container(
decoration: BoxDecoration(
image: DecorationImage(
alignment: Alignment.topCenter,
image: NetworkImage(
'https://assets.materialup.com/uploads/0ecf34f4-3948-4c5b-912d-fbd2bbe7372a/preview.gif'),
))),
SafeArea(
child: Padding(
padding: EdgeInsets.all(16.0),
child: Column(
children: <Widget>[
SizedBox(
height: 40,
),
Container(
height: 64,
margin: EdgeInsets.only(bottom: 20),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
CircleAvatar(
radius: 32,
backgroundColor: Colors.transparent,
backgroundImage: NetworkImage(
'https://www.countdown2030europe.org/storage/app/media/uploaded-files/rotating-globe-slow.gif'),
),
SizedBox(
width: 15,
),
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
'Safe Route Map',
style: TextStyle(
fontSize: 32.0,
color: Colors.deepPurpleAccent.shade700),
)
],
)
],
),
),
SizedBox(
height: 22,
),
Expanded(
child: GridView.count(
mainAxisSpacing: 10,
crossAxisSpacing: 10,
primary: false,
crossAxisCount: 2,
padding: const EdgeInsets.all(8.0),
children: <Widget>[
Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8)),
elevation: 4,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
FlatButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
MapDesignPage()),
);
},
child: Container(
height: 85.0,
width: 110.0,
decoration: BoxDecoration(
image: DecorationImage(
image: NetworkImage(
'https://c8.alamy.com/comp/P1A2B4/abstract-city-map-background-with-marker-P1A2B4.jpg'),
fit: BoxFit.cover,
),
),
child: Padding(
padding: const EdgeInsets.all(8.0),
),
),
),
SizedBox(
height: 4,
),
Text(
'COVID 19 Map',
style: TextStyle(
fontSize: 18,
color: Colors.deepPurpleAccent.shade700),
),
],
)),
Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8)),
elevation: 4,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
FlatButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => MapView()),
);
},
child: Container(
width: 110.0,
height: 95.0,
decoration: BoxDecoration(
image: DecorationImage(
image: NetworkImage(
'https://st3.depositphotos.com/1021974/12545/i/600/depositphotos_125458496-stock-photo-map-with-pin-in-route.jpg',
),
),
),
child: Padding(
padding: const EdgeInsets.all(8.0),
),
),
),
SizedBox(
height: 0,
),
Text(
'Find Route',
style: TextStyle(
fontSize: 18,
color: Colors.deepPurpleAccent.shade700),
),
],
)),
Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8)),
elevation: 4,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
FlatButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => CustomDialog()),
);
},
child: Container(
width: 110.0,
height: 80.0,
decoration: BoxDecoration(
image: DecorationImage(
image: NetworkImage(
'https://media.istockphoto.com/photos/blurred-dining-table-restaurant-with-beautiful-city-view-at-twilight-picture-id1169370670?k=6&m=1169370670&s=612x612&w=0&h=I8ZJFy28mH5o6HuNJ6AyoequAK1-pq-77rgnOtg3eHY='),
fit: BoxFit.cover,
),
),
child: Padding(
padding: const EdgeInsets.all(8.0),
),
),
),
SizedBox(
height: 4,
),
Text(
'City Details',
style: TextStyle(
fontSize: 18,
color: Colors.deepPurpleAccent.shade700),
),
],
)),
Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8)),
elevation: 4,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
FlatButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
MapDesignPage()),
);
},
child: Container(
height: 80.0,
width: 110.0,
decoration: BoxDecoration(
image: DecorationImage(
image: NetworkImage(
'https://media.istockphoto.com/photos/stethoscope-on-blue-background-picture-id866772230'),
fit: BoxFit.cover,
),
),
),
),
SizedBox(
height: 4,
),
Text(
'Other Details',
style: TextStyle(
fontSize: 18,
color: Colors.deepPurpleAccent.shade700),
),
],
)),
],
),
)
],
),
),
)
],
),
);
}
}
import 'package:flutter/material.dart';
class AlertBox extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.only(left: 0.0, right: 0.0),
child: Stack(
children: <Widget>[
Container(
margin: EdgeInsets.only(top: 13.0, right: 8.0),
decoration: BoxDecoration(
color: Colors.white,
shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(16.0),
boxShadow: <BoxShadow>[]),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
SizedBox(
height: 10.0,
),
Center(
child: Padding(
padding: const EdgeInsets.all(10.0),
child: new Text("Sorry please try \n again tomorrow",
style: TextStyle(fontSize: 10.0, color: Colors.black)),
) //
),
SizedBox(height: 14.0),
],
),
),
Positioned(
right: 0.0,
child: GestureDetector(
onTap: () {
Navigator.of(context).pop();
},
child: Align(
alignment: Alignment.topRight,
child: CircleAvatar(
radius: 14.0,
backgroundColor: Colors.white,
child: Icon(Icons.close, color: Colors.red),
),
),
),
),
],
),
);
}
}
......@@ -73,14 +73,84 @@ class _homepageState extends State<homepage> {
SystemChrome.setPreferredOrientations(
[DeviceOrientation.portraitDown, DeviceOrientation.portraitUp]);
return Scaffold(
appBar: AppBar(
title: Text("STracker"),
),
body: ListView(
children: <Widget>[
customcard("Start Quiz", images[0]),
],
),
);
appBar: AppBar(
title: Text("STracker"),
),
body: Column(
children: <Widget>[
Expanded(
flex: 1,
child: ButtonTheme(
minWidth: 800.0,
height: 100.0,
child: RaisedButton(
color: Colors.redAccent,
onPressed: () {},
child: Text(
"Hand Washing",
style: TextStyle(color: Colors.white, fontSize: 30),
),
),
)),
Expanded(
flex: 2,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[],
),
),
Expanded(
flex: 5,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
RaisedButton(
color: Colors.white,
onPressed: () {},
child: ClipRRect(
child: Image(
image: AssetImage(
"lib/assets/images/handWashingStart.gif",
),
),
),
padding: EdgeInsets.symmetric(
vertical: 10.0,
horizontal: 25.0,
),
)
],
),
),
Expanded(
flex: 4,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
RaisedButton(
color: Colors.blueAccent,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20.0)),
onPressed: () {
Navigator.of(context).pushReplacement(MaterialPageRoute(
builder: (context) => getjson(),
));
},
child: Text(
"Start Quiz",
style: TextStyle(
fontSize: 30.0,
),
),
padding: EdgeInsets.symmetric(
vertical: 20.0,
horizontal: 200.0,
),
)
],
),
)
],
));
}
}
......@@ -90,7 +90,7 @@ class _quizpageState extends State<quizpage> {
canceltimer = false;
timer = 60;
setState(() {
if (i < 5) {
if (i < 8) {
i++;
} else {
Navigator.of(context).pushReplacement(MaterialPageRoute(
......@@ -107,7 +107,7 @@ class _quizpageState extends State<quizpage> {
void checkanswer(String k) {
if (mydata[2][i.toString()] == mydata[1][i.toString()][k]) {
marks = marks + 5;
marks = marks + 15;
colortoshow = right;
} else {
colortoshow = wrong;
......@@ -131,15 +131,20 @@ class _quizpageState extends State<quizpage> {
hangState = 3;
} else if (x == 4) {
hangState = 4;
} else {
} else if (x == 5) {
hangState = 5;
} else if (x == 6) {
hangState = 6;
Navigator.of(context).pushReplacement(MaterialPageRoute(
builder: (context) => resultpage(marks: marks),
));
}
}
Widget choicebutton(String k) {
return Padding(
padding: EdgeInsets.symmetric(
vertical: 10.0,
vertical: 20.0,
horizontal: 20.0,
),
child: MaterialButton(
......@@ -148,15 +153,15 @@ class _quizpageState extends State<quizpage> {
mydata[1][i.toString()][k],
style: TextStyle(
color: Colors.white,
fontSize: 16.0,
fontSize: 20.0,
),
maxLines: 1,
),
color: btncolor[k],
splashColor: Colors.indigo[700],
highlightColor: Colors.indigo[700],
minWidth: 200.0,
height: 45.0,
minWidth: 500.0,
height: 70.0,
shape:
RoundedRectangleBorder(borderRadius: BorderRadius.circular(20.0)),
),
......@@ -191,19 +196,22 @@ class _quizpageState extends State<quizpage> {
child: Scaffold(
body: Column(
children: <Widget>[
SizedBox(
height: 20,
),
Expanded(
flex: 5,
flex: 4,
child: Material(
elevation: 20.0,
child: Container(
width: 200.0,
height: 150.0,
width: 400.0,
height: 50.0,
child: Column(
children: <Widget>[
Material(
child: Container(
width: 200.0,
height: 200.0,
width: 400.0,
height: 375.0,
child: ClipRRect(
child: Image(
image: AssetImage(
......@@ -216,15 +224,18 @@ class _quizpageState extends State<quizpage> {
)),
),
),
SizedBox(
height: 20,
),
Expanded(
flex: 2,
flex: 1,
child: Container(
padding: EdgeInsets.all(15.0),
alignment: Alignment.bottomLeft,
child: Text(
mydata[0][i.toString()],
style: TextStyle(
fontSize: 16.0,
fontSize: 30.0,
fontWeight: FontWeight.w700,
),
),
......@@ -234,7 +245,7 @@ class _quizpageState extends State<quizpage> {
),
),
Expanded(
flex: 6,
flex: 5,
child: Container(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
......
......@@ -27,81 +27,86 @@ class _resultpageState extends State<resultpage> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(
"Result",
appBar: AppBar(
title: Text(
"Result - Hand Washing",
),
),
),
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"),
),
),
body: Column(
children: <Widget>[
Expanded(
flex: 2,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[],
),
),
Expanded(
flex: 3,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
RaisedButton(
color: Colors.white,
onPressed: () {},
child: ClipRRect(
child: Image(
image: AssetImage(
"lib/assets/images/gameover.gif",
),
),
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,
),
),
))
],
)),
),
padding: EdgeInsets.symmetric(
vertical: 10.0,
horizontal: 25.0,
),
)
],
),
),
),
Expanded(
flex: 4,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
OutlineButton(
onPressed: () {
Navigator.of(context).pushReplacement(MaterialPageRoute(
builder: (context) => levelsDashboard(),
));
},
Padding(
padding: EdgeInsets.symmetric(
vertical: 5.0,
horizontal: 15.0,
),
child: Center(
child: Text(
"Continue",
"You Scored $marks marks",
style: TextStyle(
fontSize: 18.0,
fontSize: 30.0,
fontWeight: FontWeight.w900,
),
),
padding: EdgeInsets.symmetric(
vertical: 10.0,
horizontal: 25.0,
),
borderSide: BorderSide(width: 3.0, color: Colors.indigo),
splashColor: Colors.indigoAccent,
)
],
),
)
],
),
);
)),
Expanded(
flex: 4,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
RaisedButton(
color: Colors.blueAccent,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20.0)),
onPressed: () {
Navigator.of(context).pushReplacement(MaterialPageRoute(
builder: (context) => levelsDashboard(),
));
},
child: Text(
"Continue",
style: TextStyle(
fontSize: 30.0,
),
),
padding: EdgeInsets.symmetric(
vertical: 20.0,
horizontal: 200.0,
),
)
],
),
)
],
));
}
}
......@@ -91,7 +91,7 @@ class _quizpageMaskWearingState extends State<quizpageMaskWearing> {
canceltimer = false;
timer = 60;
setState(() {
if (i < 5) {
if (i < 8) {
i++;
} else {
Navigator.of(context).pushReplacement(MaterialPageRoute(
......@@ -108,7 +108,7 @@ class _quizpageMaskWearingState extends State<quizpageMaskWearing> {
void checkanswer(String k) {
if (mydata[2][i.toString()] == mydata[1][i.toString()][k]) {
marks = marks + 5;
marks = marks + 20;
colortoshow = right;
} else {
colortoshow = wrong;
......@@ -132,15 +132,20 @@ class _quizpageMaskWearingState extends State<quizpageMaskWearing> {
hangState = 3;
} else if (x == 4) {
hangState = 4;
} else {
} else if (x == 5) {
hangState = 5;
} else if (x == 6) {
hangState = 6;
Navigator.of(context).pushReplacement(MaterialPageRoute(
builder: (context) => maskWearingResultPage(marks: marks),
));
}
}
Widget choicebutton(String k) {
return Padding(
padding: EdgeInsets.symmetric(
vertical: 10.0,
vertical: 20.0,
horizontal: 20.0,
),
child: MaterialButton(
......@@ -149,15 +154,15 @@ class _quizpageMaskWearingState extends State<quizpageMaskWearing> {
mydata[1][i.toString()][k],
style: TextStyle(
color: Colors.white,
fontSize: 16.0,
fontSize: 20.0,
),
maxLines: 1,
),
color: btncolor[k],
splashColor: Colors.indigo[700],
highlightColor: Colors.indigo[700],
minWidth: 200.0,
height: 45.0,
minWidth: 500.0,
height: 70.0,
shape:
RoundedRectangleBorder(borderRadius: BorderRadius.circular(20.0)),
),
......@@ -193,18 +198,18 @@ class _quizpageMaskWearingState extends State<quizpageMaskWearing> {
body: Column(
children: <Widget>[
Expanded(
flex: 5,
flex: 4,
child: Material(
elevation: 20.0,
child: Container(
width: 200.0,
height: 150.0,
width: 400.0,
height: 50.0,
child: Column(
children: <Widget>[
Material(
child: Container(
width: 200.0,
height: 200.0,
width: 400.0,
height: 375.0,
child: ClipRRect(
child: Image(
image: AssetImage(
......@@ -218,14 +223,14 @@ class _quizpageMaskWearingState extends State<quizpageMaskWearing> {
),
),
Expanded(
flex: 2,
flex: 1,
child: Container(
padding: EdgeInsets.all(15.0),
alignment: Alignment.bottomLeft,
child: Text(
mydata[0][i.toString()],
style: TextStyle(
fontSize: 16.0,
fontSize: 30.0,
fontWeight: FontWeight.w700,
),
),
......
......@@ -4,7 +4,8 @@ import 'package:flutter/services.dart';
class maskWearingQuizStartPage extends StatefulWidget {
@override
_maskWearingQuizStartPageState createState() => _maskWearingQuizStartPageState();
_maskWearingQuizStartPageState createState() =>
_maskWearingQuizStartPageState();
}
class _maskWearingQuizStartPageState extends State<maskWearingQuizStartPage> {
......@@ -73,14 +74,84 @@ class _maskWearingQuizStartPageState extends State<maskWearingQuizStartPage> {
SystemChrome.setPreferredOrientations(
[DeviceOrientation.portraitDown, DeviceOrientation.portraitUp]);
return Scaffold(
appBar: AppBar(
title: Text("STracker"),
),
body: ListView(
children: <Widget>[
customcard("Start Quiz", images[0]),
],
),
);
appBar: AppBar(
title: Text("STracker"),
),
body: Column(
children: <Widget>[
Expanded(
flex: 1,
child: ButtonTheme(
minWidth: 800.0,
height: 100.0,
child: RaisedButton(
color: Colors.redAccent,
onPressed: () {},
child: Text(
"Mask Wearing",
style: TextStyle(color: Colors.white, fontSize: 30),
),
),
)),
Expanded(
flex: 2,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[],
),
),
Expanded(
flex: 5,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
RaisedButton(
color: Colors.white,
onPressed: () {},
child: ClipRRect(
child: Image(
image: AssetImage(
"lib/assets/images/maskWearingStart.gif",
),
),
),
padding: EdgeInsets.symmetric(
vertical: 10.0,
horizontal: 25.0,
),
)
],
),
),
Expanded(
flex: 4,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
RaisedButton(
color: Colors.blueAccent,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20.0)),
onPressed: () {
Navigator.of(context).pushReplacement(MaterialPageRoute(
builder: (context) => getjsonMaskWearing(),
));
},
child: Text(
"Start Quiz",
style: TextStyle(
fontSize: 30.0,
),
),
padding: EdgeInsets.symmetric(
vertical: 20.0,
horizontal: 200.0,
),
)
],
),
)
],
));
}
}
......@@ -27,81 +27,86 @@ class _maskWearingResultPageState extends State<maskWearingResultPage> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(
"Result for Mask Wearing",
appBar: AppBar(
title: Text(
"Result - 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"),
),
),
body: Column(
children: <Widget>[
Expanded(
flex: 2,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[],
),
),
Expanded(
flex: 3,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
RaisedButton(
color: Colors.white,
onPressed: () {},
child: ClipRRect(
child: Image(
image: AssetImage(
"lib/assets/images/gameover.gif",
),
),
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,
),
),
)),
],
)),
),
padding: EdgeInsets.symmetric(
vertical: 10.0,
horizontal: 25.0,
),
)
],
),
),
),
Expanded(
flex: 4,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
OutlineButton(
onPressed: () {
Navigator.of(context).pushReplacement(MaterialPageRoute(
builder: (context) => levelsDashboard(),
));
},
Padding(
padding: EdgeInsets.symmetric(
vertical: 5.0,
horizontal: 15.0,
),
child: Center(
child: Text(
"Continue",
"You Scored $marks marks",
style: TextStyle(
fontSize: 18.0,
fontSize: 30.0,
fontWeight: FontWeight.w900,
),
),
padding: EdgeInsets.symmetric(
vertical: 10.0,
horizontal: 25.0,
),
borderSide: BorderSide(width: 3.0, color: Colors.indigo),
splashColor: Colors.indigoAccent,
)
],
),
)
],
),
);
)),
Expanded(
flex: 4,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
RaisedButton(
color: Colors.blueAccent,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20.0)),
onPressed: () {
Navigator.of(context).pushReplacement(MaterialPageRoute(
builder: (context) => levelsDashboard(),
));
},
child: Text(
"Continue",
style: TextStyle(
fontSize: 30.0,
),
),
padding: EdgeInsets.symmetric(
vertical: 20.0,
horizontal: 200.0,
),
)
],
),
)
],
));
}
}
......@@ -91,7 +91,7 @@ class _quizpagePublicPlacesState extends State<quizpagePublicPlaces> {
canceltimer = false;
timer = 60;
setState(() {
if (i < 5) {
if (i < 8) {
i++;
} else {
Navigator.of(context).pushReplacement(MaterialPageRoute(
......@@ -108,7 +108,7 @@ class _quizpagePublicPlacesState extends State<quizpagePublicPlaces> {
void checkanswer(String k) {
if (mydata[2][i.toString()] == mydata[1][i.toString()][k]) {
marks = marks + 5;
marks = marks + 10;
colortoshow = right;
} else {
colortoshow = wrong;
......@@ -132,15 +132,20 @@ class _quizpagePublicPlacesState extends State<quizpagePublicPlaces> {
hangState = 3;
} else if (x == 4) {
hangState = 4;
} else {
} else if (x == 5) {
hangState = 5;
} else if (x == 6) {
hangState = 6;
Navigator.of(context).pushReplacement(MaterialPageRoute(
builder: (context) => publicPlacesResultPage(marks: marks),
));
}
}
Widget choicebutton(String k) {
return Padding(
padding: EdgeInsets.symmetric(
vertical: 10.0,
vertical: 20.0,
horizontal: 20.0,
),
child: MaterialButton(
......@@ -149,15 +154,15 @@ class _quizpagePublicPlacesState extends State<quizpagePublicPlaces> {
mydata[1][i.toString()][k],
style: TextStyle(
color: Colors.white,
fontSize: 16.0,
fontSize: 20.0,
),
maxLines: 1,
),
color: btncolor[k],
splashColor: Colors.indigo[700],
highlightColor: Colors.indigo[700],
minWidth: 200.0,
height: 45.0,
minWidth: 500.0,
height: 70.0,
shape:
RoundedRectangleBorder(borderRadius: BorderRadius.circular(20.0)),
),
......@@ -193,18 +198,18 @@ class _quizpagePublicPlacesState extends State<quizpagePublicPlaces> {
body: Column(
children: <Widget>[
Expanded(
flex: 5,
flex: 4,
child: Material(
elevation: 20.0,
child: Container(
width: 200.0,
height: 150.0,
width: 400.0,
height: 50.0,
child: Column(
children: <Widget>[
Material(
child: Container(
width: 200.0,
height: 200.0,
width: 400.0,
height: 375.0,
child: ClipRRect(
child: Image(
image: AssetImage(
......@@ -218,14 +223,14 @@ class _quizpagePublicPlacesState extends State<quizpagePublicPlaces> {
),
),
Expanded(
flex: 2,
flex: 1,
child: Container(
padding: EdgeInsets.all(15.0),
alignment: Alignment.bottomLeft,
child: Text(
mydata[0][i.toString()],
style: TextStyle(
fontSize: 16.0,
fontSize: 30.0,
fontWeight: FontWeight.w700,
),
),
......
......@@ -4,7 +4,8 @@ import 'package:flutter/services.dart';
class publicPlacesQuizStartPage extends StatefulWidget {
@override
_publicPlacesQuizStartPageState createState() => _publicPlacesQuizStartPageState();
_publicPlacesQuizStartPageState createState() =>
_publicPlacesQuizStartPageState();
}
class _publicPlacesQuizStartPageState extends State<publicPlacesQuizStartPage> {
......@@ -73,14 +74,84 @@ class _publicPlacesQuizStartPageState extends State<publicPlacesQuizStartPage> {
SystemChrome.setPreferredOrientations(
[DeviceOrientation.portraitDown, DeviceOrientation.portraitUp]);
return Scaffold(
appBar: AppBar(
title: Text("STracker"),
),
body: ListView(
children: <Widget>[
customcard("Start Quiz", images[0]),
],
),
);
appBar: AppBar(
title: Text("STracker"),
),
body: Column(
children: <Widget>[
Expanded(
flex: 1,
child: ButtonTheme(
minWidth: 800.0,
height: 100.0,
child: RaisedButton(
color: Colors.redAccent,
onPressed: () {},
child: Text(
"Behavioural in Public Places",
style: TextStyle(color: Colors.white, fontSize: 30),
),
),
)),
Expanded(
flex: 2,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[],
),
),
Expanded(
flex: 5,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
RaisedButton(
color: Colors.white,
onPressed: () {},
child: ClipRRect(
child: Image(
image: AssetImage(
"lib/assets/images/publicPlacesStart.gif",
),
),
),
padding: EdgeInsets.symmetric(
vertical: 10.0,
horizontal: 25.0,
),
)
],
),
),
Expanded(
flex: 4,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
RaisedButton(
color: Colors.blueAccent,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20.0)),
onPressed: () {
Navigator.of(context).pushReplacement(MaterialPageRoute(
builder: (context) => getjsonPublicPlaces(),
));
},
child: Text(
"Start Quiz",
style: TextStyle(
fontSize: 30.0,
),
),
padding: EdgeInsets.symmetric(
vertical: 20.0,
horizontal: 200.0,
),
)
],
),
)
],
));
}
}
......@@ -3,12 +3,12 @@ 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);
_publicPlacesResultPageState createState() =>
_publicPlacesResultPageState(marks);
}
class _publicPlacesResultPageState extends State<publicPlacesResultPage> {
......@@ -27,81 +27,86 @@ class _publicPlacesResultPageState extends State<publicPlacesResultPage> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(
"Result for Public Places",
appBar: AppBar(
title: Text(
"Result - Behavioural in 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"),
),
),
body: Column(
children: <Widget>[
Expanded(
flex: 2,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[],
),
),
Expanded(
flex: 3,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
RaisedButton(
color: Colors.white,
onPressed: () {},
child: ClipRRect(
child: Image(
image: AssetImage(
"lib/assets/images/gameover.gif",
),
),
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,
),
),
)),
],
)),
),
padding: EdgeInsets.symmetric(
vertical: 10.0,
horizontal: 25.0,
),
)
],
),
),
),
Expanded(
flex: 4,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
OutlineButton(
onPressed: () {
Navigator.of(context).pushReplacement(MaterialPageRoute(
builder: (context) => levelsDashboard(),
));
},
Padding(
padding: EdgeInsets.symmetric(
vertical: 5.0,
horizontal: 15.0,
),
child: Center(
child: Text(
"Continue",
"You Scored $marks marks",
style: TextStyle(
fontSize: 18.0,
fontSize: 30.0,
fontWeight: FontWeight.w900,
),
),
padding: EdgeInsets.symmetric(
vertical: 10.0,
horizontal: 25.0,
),
borderSide: BorderSide(width: 3.0, color: Colors.indigo),
splashColor: Colors.indigoAccent,
)
],
),
)
],
),
);
)),
Expanded(
flex: 4,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
RaisedButton(
color: Colors.blueAccent,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20.0)),
onPressed: () {
Navigator.of(context).pushReplacement(MaterialPageRoute(
builder: (context) => levelsDashboard(),
));
},
child: Text(
"Continue",
style: TextStyle(
fontSize: 30.0,
),
),
padding: EdgeInsets.symmetric(
vertical: 20.0,
horizontal: 200.0,
),
)
],
),
)
],
));
}
}
......@@ -5,7 +5,6 @@ import 'package:covidefender/STracker/SocialDistance/socialDistanceResultPage.da
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
class getjsonSocialDistance extends StatelessWidget {
@override
Widget build(BuildContext context) {
......@@ -37,7 +36,8 @@ class quizpageSocialDistance extends StatefulWidget {
quizpageSocialDistance({Key key, @required this.mydata}) : super(key: key);
@override
_quizpageSocialDistanceState createState() => _quizpageSocialDistanceState(mydata);
_quizpageSocialDistanceState createState() =>
_quizpageSocialDistanceState(mydata);
}
class _quizpageSocialDistanceState extends State<quizpageSocialDistance> {
......@@ -91,7 +91,7 @@ class _quizpageSocialDistanceState extends State<quizpageSocialDistance> {
canceltimer = false;
timer = 60;
setState(() {
if (i < 5) {
if (i < 8) {
i++;
} else {
Navigator.of(context).pushReplacement(MaterialPageRoute(
......@@ -108,7 +108,7 @@ class _quizpageSocialDistanceState extends State<quizpageSocialDistance> {
void checkanswer(String k) {
if (mydata[2][i.toString()] == mydata[1][i.toString()][k]) {
marks = marks + 5;
marks = marks + 20;
colortoshow = right;
} else {
colortoshow = wrong;
......@@ -132,15 +132,20 @@ class _quizpageSocialDistanceState extends State<quizpageSocialDistance> {
hangState = 3;
} else if (x == 4) {
hangState = 4;
} else {
} else if (x == 5) {
hangState = 5;
} else if (x == 6) {
hangState = 6;
Navigator.of(context).pushReplacement(MaterialPageRoute(
builder: (context) => socialDistanceResultPage(marks: marks),
));
}
}
Widget choicebutton(String k) {
return Padding(
padding: EdgeInsets.symmetric(
vertical: 10.0,
vertical: 20.0,
horizontal: 20.0,
),
child: MaterialButton(
......@@ -149,15 +154,15 @@ class _quizpageSocialDistanceState extends State<quizpageSocialDistance> {
mydata[1][i.toString()][k],
style: TextStyle(
color: Colors.white,
fontSize: 16.0,
fontSize: 20.0,
),
maxLines: 1,
),
color: btncolor[k],
splashColor: Colors.indigo[700],
highlightColor: Colors.indigo[700],
minWidth: 200.0,
height: 45.0,
minWidth: 500.0,
height: 70.0,
shape:
RoundedRectangleBorder(borderRadius: BorderRadius.circular(20.0)),
),
......@@ -193,18 +198,18 @@ class _quizpageSocialDistanceState extends State<quizpageSocialDistance> {
body: Column(
children: <Widget>[
Expanded(
flex: 5,
flex: 4,
child: Material(
elevation: 20.0,
child: Container(
width: 200.0,
height: 150.0,
width: 400.0,
height: 50.0,
child: Column(
children: <Widget>[
Material(
child: Container(
width: 200.0,
height: 200.0,
width: 400.0,
height: 375.0,
child: ClipRRect(
child: Image(
image: AssetImage(
......@@ -218,14 +223,14 @@ class _quizpageSocialDistanceState extends State<quizpageSocialDistance> {
),
),
Expanded(
flex: 2,
flex: 1,
child: Container(
padding: EdgeInsets.all(15.0),
alignment: Alignment.bottomLeft,
child: Text(
mydata[0][i.toString()],
style: TextStyle(
fontSize: 16.0,
fontSize: 30.0,
fontWeight: FontWeight.w700,
),
),
......
......@@ -4,10 +4,12 @@ import 'package:flutter/services.dart';
class socialDistanceQuizStartPage extends StatefulWidget {
@override
_socialDistanceQuizStartPageState createState() => _socialDistanceQuizStartPageState();
_socialDistanceQuizStartPageState createState() =>
_socialDistanceQuizStartPageState();
}
class _socialDistanceQuizStartPageState extends State<socialDistanceQuizStartPage> {
class _socialDistanceQuizStartPageState
extends State<socialDistanceQuizStartPage> {
List<String> images = [
"lib/assets/images/startQuiz.png",
];
......@@ -73,14 +75,84 @@ class _socialDistanceQuizStartPageState extends State<socialDistanceQuizStartPag
SystemChrome.setPreferredOrientations(
[DeviceOrientation.portraitDown, DeviceOrientation.portraitUp]);
return Scaffold(
appBar: AppBar(
title: Text("STracker"),
),
body: ListView(
children: <Widget>[
customcard("Start Quiz", images[0]),
],
),
);
appBar: AppBar(
title: Text("STracker"),
),
body: Column(
children: <Widget>[
Expanded(
flex: 1,
child: ButtonTheme(
minWidth: 800.0,
height: 100.0,
child: RaisedButton(
color: Colors.redAccent,
onPressed: () {},
child: Text(
"Social Distance",
style: TextStyle(color: Colors.white, fontSize: 30),
),
),
)),
Expanded(
flex: 2,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[],
),
),
Expanded(
flex: 5,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
RaisedButton(
color: Colors.white,
onPressed: () {},
child: ClipRRect(
child: Image(
image: AssetImage(
"lib/assets/images/socialDistanceStart.gif",
),
),
),
padding: EdgeInsets.symmetric(
vertical: 10.0,
horizontal: 25.0,
),
)
],
),
),
Expanded(
flex: 4,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
RaisedButton(
color: Colors.blueAccent,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20.0)),
onPressed: () {
Navigator.of(context).pushReplacement(MaterialPageRoute(
builder: (context) => getjsonSocialDistance(),
));
},
child: Text(
"Start Quiz",
style: TextStyle(
fontSize: 30.0,
),
),
padding: EdgeInsets.symmetric(
vertical: 20.0,
horizontal: 200.0,
),
)
],
),
)
],
));
}
}
......@@ -3,12 +3,12 @@ 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);
_socialDistanceResultPageState createState() =>
_socialDistanceResultPageState(marks);
}
class _socialDistanceResultPageState extends State<socialDistanceResultPage> {
......@@ -27,81 +27,86 @@ class _socialDistanceResultPageState extends State<socialDistanceResultPage> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(
"Result for Social Distance",
appBar: AppBar(
title: Text(
"Result - 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"),
),
),
body: Column(
children: <Widget>[
Expanded(
flex: 2,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[],
),
),
Expanded(
flex: 3,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
RaisedButton(
color: Colors.white,
onPressed: () {},
child: ClipRRect(
child: Image(
image: AssetImage(
"lib/assets/images/gameover.gif",
),
),
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,
),
),
)),
],
)),
),
padding: EdgeInsets.symmetric(
vertical: 10.0,
horizontal: 25.0,
),
)
],
),
),
),
Expanded(
flex: 4,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
OutlineButton(
onPressed: () {
Navigator.of(context).pushReplacement(MaterialPageRoute(
builder: (context) => levelsDashboard(),
));
},
Padding(
padding: EdgeInsets.symmetric(
vertical: 5.0,
horizontal: 15.0,
),
child: Center(
child: Text(
"Continue",
"You Scored $marks marks",
style: TextStyle(
fontSize: 18.0,
fontSize: 30.0,
fontWeight: FontWeight.w900,
),
),
padding: EdgeInsets.symmetric(
vertical: 10.0,
horizontal: 25.0,
),
borderSide: BorderSide(width: 3.0, color: Colors.indigo),
splashColor: Colors.indigoAccent,
)
],
),
)
],
),
);
)),
Expanded(
flex: 4,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
RaisedButton(
color: Colors.blueAccent,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20.0)),
onPressed: () {
Navigator.of(context).pushReplacement(MaterialPageRoute(
builder: (context) => levelsDashboard(),
));
},
child: Text(
"Continue",
style: TextStyle(
fontSize: 30.0,
),
),
padding: EdgeInsets.symmetric(
vertical: 20.0,
horizontal: 200.0,
),
)
],
),
)
],
));
}
}
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) {
......@@ -92,7 +90,7 @@ class _quizpageSymptomsState extends State<quizpageSymptoms> {
canceltimer = false;
timer = 60;
setState(() {
if (i < 5) {
if (i < 8) {
i++;
} else {
Navigator.of(context).pushReplacement(MaterialPageRoute(
......@@ -133,15 +131,20 @@ class _quizpageSymptomsState extends State<quizpageSymptoms> {
hangState = 3;
} else if (x == 4) {
hangState = 4;
} else {
} else if (x == 5) {
hangState = 5;
} else if (x == 6) {
hangState = 6;
Navigator.of(context).pushReplacement(MaterialPageRoute(
builder: (context) => symptomsResultPage(marks: marks),
));
}
}
Widget choicebutton(String k) {
return Padding(
padding: EdgeInsets.symmetric(
vertical: 10.0,
vertical: 20.0,
horizontal: 20.0,
),
child: MaterialButton(
......@@ -150,15 +153,15 @@ class _quizpageSymptomsState extends State<quizpageSymptoms> {
mydata[1][i.toString()][k],
style: TextStyle(
color: Colors.white,
fontSize: 16.0,
fontSize: 20.0,
),
maxLines: 1,
),
color: btncolor[k],
splashColor: Colors.indigo[700],
highlightColor: Colors.indigo[700],
minWidth: 200.0,
height: 45.0,
minWidth: 500.0,
height: 70.0,
shape:
RoundedRectangleBorder(borderRadius: BorderRadius.circular(20.0)),
),
......@@ -194,18 +197,18 @@ class _quizpageSymptomsState extends State<quizpageSymptoms> {
body: Column(
children: <Widget>[
Expanded(
flex: 5,
flex: 4,
child: Material(
elevation: 20.0,
child: Container(
width: 200.0,
height: 150.0,
width: 400.0,
height: 50.0,
child: Column(
children: <Widget>[
Material(
child: Container(
width: 200.0,
height: 200.0,
width: 400.0,
height: 375.0,
child: ClipRRect(
child: Image(
image: AssetImage(
......@@ -219,14 +222,14 @@ class _quizpageSymptomsState extends State<quizpageSymptoms> {
),
),
Expanded(
flex: 2,
flex: 1,
child: Container(
padding: EdgeInsets.all(15.0),
alignment: Alignment.bottomLeft,
child: Text(
mydata[0][i.toString()],
style: TextStyle(
fontSize: 16.0,
fontSize: 20.0,
fontWeight: FontWeight.w700,
),
),
......
......@@ -74,14 +74,84 @@ class _symptomsQuizStartPageState extends State<symptomsQuizStartPage> {
SystemChrome.setPreferredOrientations(
[DeviceOrientation.portraitDown, DeviceOrientation.portraitUp]);
return Scaffold(
appBar: AppBar(
title: Text("STracker"),
),
body: ListView(
children: <Widget>[
customcard("Start Quiz", images[0]),
],
),
);
appBar: AppBar(
title: Text("STracker"),
),
body: Column(
children: <Widget>[
Expanded(
flex: 1,
child: ButtonTheme(
minWidth: 800.0,
height: 100.0,
child: RaisedButton(
color: Colors.redAccent,
onPressed: () {},
child: Text(
"Symptoms",
style: TextStyle(color: Colors.white, fontSize: 30),
),
),
)),
Expanded(
flex: 2,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[],
),
),
Expanded(
flex: 5,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
RaisedButton(
color: Colors.white,
onPressed: () {},
child: ClipRRect(
child: Image(
image: AssetImage(
"lib/assets/images/symStart2.gif",
),
),
),
padding: EdgeInsets.symmetric(
vertical: 10.0,
horizontal: 25.0,
),
)
],
),
),
Expanded(
flex: 4,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
RaisedButton(
color: Colors.blueAccent,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20.0)),
onPressed: () {
Navigator.of(context).pushReplacement(MaterialPageRoute(
builder: (context) => getjsonSymptoms(),
));
},
child: Text(
"Start Quiz",
style: TextStyle(
fontSize: 30.0,
),
),
padding: EdgeInsets.symmetric(
vertical: 20.0,
horizontal: 200.0,
),
)
],
),
)
],
));
}
}
......@@ -3,7 +3,6 @@ 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);
......@@ -27,81 +26,86 @@ class _symptomsResultPageState extends State<symptomsResultPage> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(
"Result for Social Distance",
appBar: AppBar(
title: Text(
"Result - Symptoms",
),
),
),
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"),
),
),
body: Column(
children: <Widget>[
Expanded(
flex: 2,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[],
),
),
Expanded(
flex: 3,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
RaisedButton(
color: Colors.white,
onPressed: () {},
child: ClipRRect(
child: Image(
image: AssetImage(
"lib/assets/images/gameover.gif",
),
),
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,
),
),
)),
],
)),
),
padding: EdgeInsets.symmetric(
vertical: 10.0,
horizontal: 25.0,
),
)
],
),
),
),
Expanded(
flex: 4,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
OutlineButton(
onPressed: () {
Navigator.of(context).pushReplacement(MaterialPageRoute(
builder: (context) => levelsDashboard(),
));
},
Padding(
padding: EdgeInsets.symmetric(
vertical: 5.0,
horizontal: 15.0,
),
child: Center(
child: Text(
"Continue",
"You Scored $marks marks",
style: TextStyle(
fontSize: 18.0,
fontSize: 30.0,
fontWeight: FontWeight.w900,
),
),
padding: EdgeInsets.symmetric(
vertical: 10.0,
horizontal: 25.0,
),
borderSide: BorderSide(width: 3.0, color: Colors.indigo),
splashColor: Colors.indigoAccent,
)
],
),
)
],
),
);
)),
Expanded(
flex: 4,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
RaisedButton(
color: Colors.blueAccent,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20.0)),
onPressed: () {
Navigator.of(context).pushReplacement(MaterialPageRoute(
builder: (context) => levelsDashboard(),
));
},
child: Text(
"Continue",
style: TextStyle(
fontSize: 30.0,
),
),
padding: EdgeInsets.symmetric(
vertical: 20.0,
horizontal: 200.0,
),
)
],
),
)
],
));
}
}
import 'package:covidefender/STracker/HandWashing/quizpage.dart';
import 'package:covidefender/STracker/levelsDashboard.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'variables.dart';
class finalOverallResultPage extends StatefulWidget {
String marks;
finalOverallResultPage() : super();
@override
_finalOverallResultPageState createState() => _finalOverallResultPageState();
}
class _finalOverallResultPageState extends State<finalOverallResultPage> {
// int ima;
_finalOverallResultPageState();
@override
void initState() {
setLevel();
super.initState();
}
void setLevel() {
print('marks6');
print(marks6);
if(marks6 == 'Very Low'){
// ima = 100;
print('1');
}else if(marks6 == 'Low'){
// ima = 200;
print('2');
}else if(marks6 == 'Moderate'){
// ima = 300;
print('3');
}else if(marks6 == 'High'){
// ima = 400;
print('4');
}else if(marks6 == 'Very High'){
// ima = 500;
print('5');
}
}
Widget customcard(String type, String image) {
return Padding(
padding: EdgeInsets.all(
20.0,
),
child: InkWell(
onTap: () {
// Navigator.of(context).pushReplacement(MaterialPageRoute(
// builder: (context) => getjson(),
// ));
},
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: Column(
children: <Widget>[
Expanded(
flex: 1,
child: ButtonTheme(
minWidth: 800.0,
height: 100.0,
child: RaisedButton(
color: Colors.redAccent,
onPressed: () {},
child: Text(
"Overall Awareness Level",
style: TextStyle(color: Colors.white, fontSize: 30),
),
),
)),
Expanded(
flex: 2,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[],
),
),
Expanded(
flex: 8,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
RaisedButton(
color: Colors.white,
onPressed: () {},
child: ClipRRect(
child: Image(
image: AssetImage(
"lib/assets/images/awarenessLevel.gif",
),
),
),
padding: EdgeInsets.symmetric(
vertical: 10.0,
horizontal: 25.0,
),
)
],
),
),
Expanded(
flex: 2,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
RaisedButton(
color: Colors.white,
onPressed: () {},
child: Text(
"Your Awareness Level - $marks6",
style: TextStyle(color: Colors.red, fontSize: 30),
),
padding: EdgeInsets.symmetric(
vertical: 10.0,
horizontal: 25.0,
),
)
],
),
),
Expanded(
flex: 2,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
RaisedButton(
color: Colors.white,
onPressed: () {},
child: Image(
image: AssetImage(
"lib/assets/images/100.png",
),
),
padding: EdgeInsets.symmetric(
vertical: 10.0,
horizontal: 25.0,
),
)
],
),
),
Expanded(
flex: 4,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
RaisedButton(
color: Colors.blueAccent,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20.0)),
onPressed: () {
Navigator.of(context).pushReplacement(MaterialPageRoute(
builder: (context) => levelsDashboard(),
));
},
child: Text(
"Registration",
style: TextStyle(
fontSize: 30.0,
),
),
padding: EdgeInsets.symmetric(
vertical: 20.0,
horizontal: 200.0,
),
)
],
),
)
],
));
}
}
import 'dart:convert';
import 'package:covidefender/STracker/finalOverallResultsPage.dart';
import 'package:flutter/material.dart';
import 'levelsDashboard.dart';
import 'variables.dart';
import 'package:http/http.dart' as http;
class finalResult extends StatefulWidget {
int marks;
......@@ -12,9 +16,177 @@ class finalResult extends StatefulWidget {
class _finalResultState extends State<finalResult> {
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 = '';
_finalResultState();
@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 = '04';
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(
......@@ -25,26 +197,35 @@ class _finalResultState extends State<finalResult> {
body: Column(
children: <Widget>[
Expanded(
flex: 20,
child: Material(
elevation: 10.0,
child: Container(
width: 300.0,
width: 800.0,
height: 300.0,
child: Column(
children: <Widget>[
Material(
child: Container(
width: 300.0,
width: 500.0,
height: 300.0,
child: ClipRRect(
child: Image(
image:
AssetImage("lib/assets/images/gameover.jpg"),
),
child: Image.asset(
'lib/assets/images/finalResult.gif',
fit: BoxFit.contain,
width: 600,
height: 600,
),
),
),
SizedBox(
height: 20,
),
CircleAvatar(
radius: 40.0,
backgroundColor: Colors.white,
child: Image(
image: AssetImage("lib/assets/images/$ima1.png"),
),
),
Padding(
padding: EdgeInsets.symmetric(
vertical: 5.0,
......@@ -52,13 +233,20 @@ class _finalResultState extends State<finalResult> {
),
child: Center(
child: Text(
"Hand Washing - $marks1",
"Hand Washing - $marks1 / 120 \n \t \t \t \t \t \t $handWashingLevel",
style: TextStyle(
fontSize: 20.0,
fontWeight: FontWeight.w700,
),
),
)),
CircleAvatar(
radius: 40.0,
backgroundColor: Colors.white,
child: Image(
image: AssetImage("lib/assets/images/$ima2.png"),
),
),
Padding(
padding: EdgeInsets.symmetric(
vertical: 5.0,
......@@ -66,13 +254,20 @@ class _finalResultState extends State<finalResult> {
),
child: Center(
child: Text(
"Mask Wearing - $marks2",
"Mask Wearing - $marks2 / 160 \n \t \t \t \t \t \t \t $maskWearingLevel",
style: TextStyle(
fontSize: 20.0,
fontWeight: FontWeight.w700,
),
),
)),
CircleAvatar(
radius: 40.0,
backgroundColor: Colors.white,
child: Image(
image: AssetImage("lib/assets/images/$ima3.png"),
),
),
Padding(
padding: EdgeInsets.symmetric(
vertical: 5.0,
......@@ -80,13 +275,20 @@ class _finalResultState extends State<finalResult> {
),
child: Center(
child: Text(
"Social Distance - $marks3",
"Social Distance - $marks3 / 160 \n \t \t \t \t \t \t \t $socialDistanceLevel",
style: TextStyle(
fontSize: 20.0,
fontWeight: FontWeight.w700,
),
),
)),
CircleAvatar(
radius: 40.0,
backgroundColor: Colors.white,
child: Image(
image: AssetImage("lib/assets/images/$ima4.png"),
),
),
Padding(
padding: EdgeInsets.symmetric(
vertical: 5.0,
......@@ -94,13 +296,20 @@ class _finalResultState extends State<finalResult> {
),
child: Center(
child: Text(
"Public places - $marks4",
"Public places - $marks4 / 80 \n \t \t \t \t \t $publicPlacesLevel",
style: TextStyle(
fontSize: 20.0,
fontWeight: FontWeight.w700,
),
),
)),
CircleAvatar(
radius: 40.0,
backgroundColor: Colors.white,
child: Image(
image: AssetImage("lib/assets/images/$ima5.png"),
),
),
Padding(
padding: EdgeInsets.symmetric(
vertical: 5.0,
......@@ -108,44 +317,43 @@ class _finalResultState extends State<finalResult> {
),
child: Center(
child: Text(
"Symptoms - $marks5",
"Symptoms - $marks5 / 40 \n \t \t \t $publicPlacesLevel",
style: TextStyle(
fontSize: 20.0,
fontWeight: FontWeight.w700,
),
),
)),
SizedBox(
height: 20,
),
RaisedButton(
color: Colors.blueAccent,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20.0)),
onPressed: () {
print("EEEE");
check();
Navigator.of(context)
.pushReplacement(MaterialPageRoute(
builder: (context) => finalOverallResultPage(),
));
},
child: Text(
"Overall Awareness Level",
style: TextStyle(
fontSize: 30.0,
),
),
padding: EdgeInsets.symmetric(
vertical: 20.0,
horizontal: 150.0,
),
)
],
)),
),
),
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,
)
],
),
)
],
),
);
......
......@@ -72,7 +72,7 @@ class _levelsDashboardState extends State<levelsDashboard> {
Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8)),
elevation: 4,
elevation: 10,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
......@@ -85,10 +85,17 @@ class _levelsDashboardState extends State<levelsDashboard> {
);
},
child: Image.asset(
'lib/assets/images/handWashing.png'),
'lib/assets/images/handWashing.png',
fit: BoxFit.contain,
width: 200,
height: 200,
),
),
Text('Hand Washing',
style: TextStyle(fontSize: 20.0)),
style: TextStyle(
fontSize: 30.0,
fontWeight: FontWeight.w700,
)),
],
)),
Card(
......@@ -108,10 +115,17 @@ class _levelsDashboardState extends State<levelsDashboard> {
);
},
child: Image.asset(
'lib/assets/images/maskWearing.png'),
'lib/assets/images/maskWearing.png',
fit: BoxFit.contain,
width: 200,
height: 200,
),
),
Text('Mask Wearing',
style: TextStyle(fontSize: 20.0))
style: TextStyle(
fontSize: 30.0,
fontWeight: FontWeight.w700,
))
],
)),
Card(
......@@ -131,10 +145,17 @@ class _levelsDashboardState extends State<levelsDashboard> {
);
},
child: Image.asset(
'lib/assets/images/socialDistance.png'),
'lib/assets/images/socialDistance.png',
fit: BoxFit.contain,
width: 200,
height: 200,
),
),
Text('Socila Distance',
style: TextStyle(fontSize: 20.0))
style: TextStyle(
fontSize: 30.0,
fontWeight: FontWeight.w700,
))
],
)),
Card(
......@@ -154,10 +175,17 @@ class _levelsDashboardState extends State<levelsDashboard> {
);
},
child: Image.asset(
'lib/assets/images/publicPlaces.png'),
'lib/assets/images/publicPlaces.png',
fit: BoxFit.contain,
width: 200,
height: 200,
),
),
Text('Public Places',
style: TextStyle(fontSize: 20.0))
style: TextStyle(
fontSize: 30.0,
fontWeight: FontWeight.w700,
))
],
)),
Card(
......@@ -170,18 +198,27 @@ class _levelsDashboardState extends State<levelsDashboard> {
FlatButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => symptomsQuizStartPage()),
);
context,
MaterialPageRoute(
builder: (context) =>
symptomsQuizStartPage()),
);
},
child: Image.asset(
'lib/assets/images/symptoms.png'),
'lib/assets/images/symptoms.png',
fit: BoxFit.contain,
width: 200,
height: 200,
),
),
Text('Symptoms',
style: TextStyle(fontSize: 20.0))
style: TextStyle(
fontSize: 30.0,
fontWeight: FontWeight.w700,
))
],
)),
Card(
Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8)),
elevation: 4,
......@@ -191,17 +228,24 @@ class _levelsDashboardState extends State<levelsDashboard> {
FlatButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => finalResult()),
);
context,
MaterialPageRoute(
builder: (context) => finalResult()),
);
},
child: Image.asset(
'lib/assets/images/symptoms.png'),
'lib/assets/images/result.png',
fit: BoxFit.contain,
width: 200,
height: 200,
),
),
Text('Final Result',
style: TextStyle(fontSize: 20.0))
style: TextStyle(
fontSize: 30.0,
fontWeight: FontWeight.w700))
],
)),
)),
],
),
)
......
......@@ -58,6 +58,21 @@ class _strackerDasboardState extends State<strackerDasboard> {
),
),
Expanded(
flex: 3,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
CircleAvatar(
radius: 100,
backgroundColor: Colors.transparent,
backgroundImage:
AssetImage('lib/assets/images/stracker.PNG'),
),
],
),
),
Expanded(
flex: 9,
child: GridView.count(
mainAxisSpacing: 10,
crossAxisSpacing: 10,
......@@ -76,13 +91,21 @@ class _strackerDasboardState extends State<strackerDasboard> {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => levelsDashboard()),
builder: (context) =>
levelsDashboard()),
);
},
child:
Image.asset('lib/assets/images/play.png'),
child: Image.asset(
'lib/assets/images/play.png',
fit: BoxFit.contain,
width: 200,
height: 200,
),
),
Text('Play', style: TextStyle(fontSize: 20.0)),
Text('Play',
style: TextStyle(
fontSize: 30.0,
fontWeight: FontWeight.w700)),
],
)),
Card(
......@@ -100,10 +123,16 @@ class _strackerDasboardState extends State<strackerDasboard> {
// );
// },
child: Image.asset(
'lib/assets/images/instructions.png'),
'lib/assets/images/instructions.png',
fit: BoxFit.contain,
width: 200,
height: 200,
),
),
Text('Instructions',
style: TextStyle(fontSize: 20.0))
style: TextStyle(
fontSize: 30.0,
fontWeight: FontWeight.w700))
],
)),
Card(
......@@ -121,10 +150,16 @@ class _strackerDasboardState extends State<strackerDasboard> {
// );
// },
child: Image.asset(
'lib/assets/images/score.png'),
'lib/assets/images/score.png',
fit: BoxFit.contain,
width: 200,
height: 200,
),
),
Text('Score Board',
style: TextStyle(fontSize: 20.0))
style: TextStyle(
fontSize: 30.0,
fontWeight: FontWeight.w700))
],
)),
Card(
......@@ -142,10 +177,16 @@ class _strackerDasboardState extends State<strackerDasboard> {
// );
// },
child: Image.asset(
'lib/assets/images/awrenessLevel.png'),
'lib/assets/images/awrenessLevel.png',
fit: BoxFit.contain,
width: 200,
height: 200,
),
),
Text('Awreness Level',
style: TextStyle(fontSize: 20.0))
style: TextStyle(
fontSize: 30.0,
fontWeight: FontWeight.w700))
],
)),
],
......
......@@ -4,3 +4,5 @@ int marks2 = 0;
int marks3 = 0;
int marks4 = 0;
int marks5 = 0;
String marks6 = '';
......@@ -4,7 +4,10 @@
"2": "Question 2: What is the best tap to wash your hands on this Covid 19 disaster situation?",
"3": "Question 3: When you come home after visiting public places, is it your duty to clean your hands first?",
"4": "Question 4: You must wash and clean your hands before eating something? Is this a good habit?",
"5": "Question 5: What is good for clean your hands"
"5": "Question 5: What is good for clean your hands?",
"6": "Question 6: Is it good to clean your hands after you visit a supermarket?",
"7": "Question 7: Can the coronavirus disease spread through hands of a person",
"8": "Question 8: How much time is good for wash hands with soap and water"
},
{
"1": {
......@@ -36,6 +39,24 @@
"b": "Filtered water",
"c": "Clean, running water",
"d": "Well water"
},
"6": {
"a": "No need to do always",
"b": "Not applicable",
"c": "Yes. must to do",
"d": "Sometimes"
},
"7": {
"a": "Yes, It has a major posibility",
"b": "Yes, It has a minor posibility",
"c": "No, It can not be hapen",
"d": "No, It is not applicable"
},
"8": {
"a": "At least 05 seconds",
"b": "At least 20 minutes",
"c": "At least 20 seconds",
"d": "At least 10 minutes"
}
},
{
......@@ -43,6 +64,9 @@
"2": "Operate by leg",
"3": "Yes, it is must",
"4": "Yes. must to do",
"5": "Clean, running water"
"5": "Clean, running water",
"6": "Yes. must to do",
"7": "Yes, It has a major posibility",
"8": "At least 20 seconds"
}
]
\ No newline at end of file
[
{
"1": "Question 1: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"2": "Question 2: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"3": "Question 3: ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc",
"4": "Question 4: ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd",
"5": "Question 5: eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"
"1": "Question 1: Does wearing mask help to reduce the spread of Covid 19?",
"2": "Question 2: Do you wear a mask when you go out in public?",
"3": "Question 3: When choosing a mask how important its comfort and fit ( to your particular face shape )?",
"4": "Question 4: What is the type of mask that you wear usually?",
"5": "Question 5: How important is changing the mask daily in reducing the possibility of transmitting infection to myself and to others?",
"6": "Question 6: Do you have adequate knowledge about how to wear a mask properly?",
"7": "Question 7: Do you cover the nose while wearing the mask?",
"8": "Question 8: How important is it to dispose the used mask properly?"
},
{
"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"
"a": "Yes a lot",
"b": "Yes some",
"c": "Not sure",
"d": "No it does nothing"
},
"2": {
"a": "Operate by hand",
"b": "Operate by mouth",
"c": "Operate by nose",
"d": "Operate by leg"
"a": "Yes, sometimes",
"b": "I dont remember",
"c": "Yes, always",
"d": "Never"
},
"3": {
"a": "May be",
"b": "Sometimes",
"c": "Yes, it is must",
"a": "Not important",
"b": "Little important",
"c": "Important",
"d": "Never"
},
"4": {
"a": "Yes. must to do",
"b": "Sometimes",
"c": "No need to do always",
"d": "Not applicable"
"a": "Clothing mask",
"b": "Surgical mask",
"c": "N95 mask",
"d": "Non of this"
},
"5": {
"a": "Tank water",
"b": "Filtered water",
"c": "Clean, running water",
"d": "Well water"
"a": "Very important",
"b": "Important",
"c": "Little important",
"d": "Not important"
},
"6": {
"a": "no, nothing",
"b": "Not sure",
"c": "Yes, some knowledge",
"d": "Yes, very good knowledge"
},
"7": {
"a": "Never",
"b": "Yes, sometimes",
"c": "Yes, always",
"d": "I dont remember"
},
"8": {
"a": "Not important",
"b": "Little important",
"c": "Imporatant",
"d": "Very important"
}
},
{
"1": "Wash my hands of germs",
"2": "Operate by leg",
"3": "Yes, it is must",
"4": "Yes. must to do",
"5": "Clean, running water"
"1": "Yes a lot",
"2": "Yes, always",
"3": "Very important",
"4": "N95 mask",
"5": "Very important",
"6": "Yes, very good knowledge",
"7": "Yes, always",
"8": "Very important"
}
]
\ 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": "Question 1: In recent days have you gone to any crowded places?",
"2": "Question 2: Your level of risk of infection with COVID 19?",
"3": "Question 3: Are you going to meeting your friends/ relatives in this lock down period?",
"4": "Question 4: Do you limit physical contact ( hand shaking) in public places?",
"5": "Question 5: Do you eat or drink in bars and resturents in these days?",
"6": "Question 6: Do you prefer to stay at home ?",
"7": "Question 7: Do you follow the health guidelines when you are in public places?",
"8": "Question 8: How do you buy foods and other goods in this endemic period?"
},
{
"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"
"a": "Yes, a lot",
"b": "Yes, but few",
"c": "No",
"d": "I cant remember"
},
"2": {
"a": "Operate by hand",
"b": "Operate by mouth",
"c": "Operate by nose",
"d": "Operate by leg"
"a": "High",
"b": "Moderate",
"c": "Low",
"d": "Very low"
},
"3": {
"a": "May be",
"b": "Sometimes",
"c": "Yes, it is must",
"d": "Never"
"a": "Yes, of course",
"b": "May be",
"c": "Never",
"d": "I dont know"
},
"4": {
"a": "Yes. must to do",
"b": "Sometimes",
"c": "No need to do always",
"d": "Not applicable"
"a": "Yes, sometimes",
"b": "Yes, always",
"c": "Never",
"d": "I cant remember"
},
"5": {
"a": "Tank water",
"b": "Filtered water",
"c": "Clean, running water",
"d": "Well water"
}
"a": "Yes, all the time",
"b": "May be sometimes",
"c": "Never",
"d": "I cant remember"
},
"6": {
"a": "Not applicable",
"b": "Hate it",
"c": "Somewhat ok",
"d": "Yes, love it"
},
"7": {
"a": "Never",
"b": "Yes, sometimes",
"c": "Yes, always",
"d": "I cant remember"
},
"8": {
"a": "By online ordering",
"b": "By visiting to the shop",
"c": "By both methods",
"d": "Non of these methods"
}
},
{
"1": "Wash my hands of germs",
"2": "Operate by leg",
"3": "Yes, it is must",
"4": "Yes. must to do",
"5": "Clean, running water"
"1": "Yes, a lot",
"2": "Very low",
"3": "Never",
"4": "Yes, always",
"5": "Yes, all the time",
"6": "Yes, love it",
"7": "Yes, always",
"8": "By online ordering"
}
]
\ 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": "Question 1: Does keeping social distance help to reduce the spread of COVID 19?",
"2": "Question 2: Are you practicing any kind of social distancing when you are at public places?",
"3": "Question 3: What is the ideal distance you have to maintain when you are in a crowded place?",
"4": "Question 4: Do you cover your nose and mouth during coughing or sneezing with the elbow or tissue?",
"5": "Question 5: How does the COVID 19 virus spread?",
"6": "Question 6: Do you listen and follow the guidelines regarding social distancing when you are at a crowded place.",
"7": "Question 7: Do you think lockdown will improve the controlling of COVID 19?",
"8": "Question 8: Your level of knowledge in social distancing?"
},
{
"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"
"a": "No it does nothing",
"b": "Not sure",
"c": "Yes, some",
"d": "Yes, a lot"
},
"2": {
"a": "Operate by hand",
"b": "Operate by mouth",
"c": "Operate by nose",
"d": "Operate by leg"
"a": "Yes, sometimes",
"b": "Yes, always",
"c": "Never",
"d": "I cant remember"
},
"3": {
"a": "May be",
"b": "Sometimes",
"c": "Yes, it is must",
"d": "Never"
"a": "0.5 meter distance",
"b": "2 meter distance",
"c": "0.2 meter distance",
"d": "0.02 meter distance"
},
"4": {
"a": "Yes. must to do",
"b": "Sometimes",
"c": "No need to do always",
"a": "Yes, sometimes",
"b": "Never",
"c": "Yes, always",
"d": "Not applicable"
},
"5": {
"a": "Tank water",
"b": "Filtered water",
"c": "Clean, running water",
"d": "Well water"
}
"a": "Air borne",
"b": "Respiratory droplets and personal contact",
"c": "Animal contact",
"d": "No idea"
},
"6": {
"a": "I cant remember",
"b": "Never",
"c": "Yes, sometimes",
"d": "Yes, always"
},
"7": {
"a": "No, It will not",
"b": "Filtered water",
"c": "Yes, absolutely",
"d": "I have no idea"
},
"8": {
"a": "High level",
"b": "Moderate level",
"c": "Low level",
"d": "Very low level"
}
},
{
"1": "Wash my hands of germs",
"2": "Operate by leg",
"3": "Yes, it is must",
"4": "Yes. must to do",
"5": "Clean, running water"
"1": "Yes, a lot",
"2": "Yes, always",
"3": "2 meter distance",
"4": "Yes, always",
"5": "Respiratory droplets and personal contact",
"6": "Yes, always",
"7": "Yes, absolutely",
"8": "High level"
}
]
\ No newline at end of file
[
{
"1": "Question 1: yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy",
"1": "Question 1: Your knowledge about the symptoms of COVID 19 ?",
"2": "Question 2: mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm",
"3": "Question 3: sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss",
"4": "Question 4: ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd",
"5": "Question 5: eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"
},
"5": "Question 5: eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
"6": "Question 6: eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
"7": "Question 7: eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
"8": "Question 8: eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"
},
{
"1": {
"a": "Keep my hands beautiful",
......@@ -37,12 +40,36 @@
"c": "Clean, running water",
"d": "Well water"
}
,
"6": {
"a": "Tank water",
"b": "Filtered water",
"c": "Clean, running water",
"d": "Well water"
}
,
"7": {
"a": "Tank water",
"b": "Filtered water",
"c": "Clean, running water",
"d": "Well water"
}
,
"8": {
"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"
"5": "Clean, running water",
"6": "Clean, running water",
"7": "Clean, running water",
"8": "Clean, running water"
}
]
\ No newline at end of file
import 'package:covidefender/I_GUIDER/splashIguider.dart';
import 'package:covidefender/SRouter/srouterDashboard.dart';
import 'package:covidefender/STracker/splash.dart';
import 'package:covidefender/EAnalyzer/Loading.dart';
import 'package:covidefender/loginPage.dart';
import 'package:flutter/material.dart';
class HomeScreen extends StatefulWidget {
......@@ -77,13 +79,17 @@ class _HomeScreenState extends State<HomeScreen> {
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Container(
height: size.height * .1,
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage(
'lib/assets/images/man80.png')),
)),
FlatButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => loginPage()),
);
},
child: Image.asset(
'lib/assets/images/man80.png'),
),
Text('My Profile',
style: TextStyle(fontSize: 20.0))
],
......@@ -95,13 +101,18 @@ class _HomeScreenState extends State<HomeScreen> {
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Container(
height: size.height * .1,
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage(
'lib/assets/images/map80.png')),
)),
FlatButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
SrouterDashboard()),
);
},
child: Image.asset(
'lib/assets/images/map80.png'),
),
Text('Map', style: TextStyle(fontSize: 20.0))
],
)),
......
import 'package:covidefender/mainRegisterPage.dart';
import 'package:flutter/material.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
class loginPage extends StatefulWidget {
@override
_loginPageState createState() => _loginPageState();
}
class _loginPageState extends State<loginPage> {
String hotelName;
String district;
int nearToDistrict;
int noOfPeople;
String date;
int ima = 0;
getHotelName(hotelName) {
this.hotelName = hotelName;
}
getDistrict(district) {
this.district = district;
}
getNearDistrict(nearToDistrict) {
this.nearToDistrict = nearToDistrict;
}
getPeople(noOfPeople) {
this.noOfPeople = noOfPeople;
}
getDate(date) {
this.date = date;
}
final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
Widget _buildHotelName() {
return TextFormField(
decoration: InputDecoration(
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.indigo[900]),
borderRadius: BorderRadius.all(Radius.circular(20))),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.green),
borderRadius: BorderRadius.all(Radius.circular(20))),
prefixIcon: Icon(Icons.home),
hintText: "Enter Username",
labelText: 'Username'),
// ignore: missing_return
validator: (String value) {},
);
}
Widget _buildDistrict() {
return TextFormField(
decoration: InputDecoration(
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.indigo[900]),
borderRadius: BorderRadius.all(Radius.circular(20))),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.green),
borderRadius: BorderRadius.all(Radius.circular(20))),
prefixIcon: Icon(Icons.location_on),
hintText: "Enter Password",
labelText: 'Password'),
// ignore: missing_return
validator: (String value) {},
// onSaved: (String value){
// _fName = value;
// },
onChanged: (String district) {
getDistrict(district);
},
);
}
//---------------------------------------------Near To District-----------------------------------------------------
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backwardsCompatibility: false,
backgroundColor: Colors.blueAccent,
title: Text("CoviDefender"),
),
body: Container(
margin: EdgeInsets.all(24),
child: Form(
key: _formKey,
child: ListView(
scrollDirection: Axis.vertical,
//mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
SizedBox(height: 100),
Padding(
padding: EdgeInsets.symmetric(
vertical: 5.0,
horizontal: 15.0,
),
child: Center(
child: Text(
"CoviDefender",
style: TextStyle(
fontSize: 50.0,
fontWeight: FontWeight.w900,
),
),
)),
CircleAvatar(
radius: 180.0,
backgroundColor: Colors.white,
child: Image(
image: AssetImage("lib/assets/images/corona.gif"),
),
),
SizedBox(height: 100),
_buildHotelName(),
SizedBox(height: 10),
_buildDistrict(),
SizedBox(height: 50),
RaisedButton(
color: Colors.blueAccent,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20.0)),
onPressed: () {
// Navigator.of(context).pushReplacement(MaterialPageRoute(
// builder: (context) => finalOverallResultPage(),
// ));
},
child: Text(
"Login",
style: TextStyle(
fontSize: 30.0,
),
),
padding: EdgeInsets.symmetric(
vertical: 20.0,
horizontal: 150.0,
),
),
SizedBox(height: 50),
RaisedButton(
color: Colors.green,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20.0)),
onPressed: () {
Navigator.of(context).pushReplacement(MaterialPageRoute(
builder: (context) => mainRegisterPage(),
));
},
child: Text(
"Register",
style: TextStyle(
fontSize: 30.0,
),
),
padding: EdgeInsets.symmetric(
vertical: 20.0,
horizontal: 150.0,
),
)
],
),
),
),
);
}
}
import 'package:covidefender/STracker/HandWashing/quizpage.dart';
import 'package:covidefender/STracker/splash.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
class mainRegisterPage extends StatefulWidget {
@override
_mainRegisterPageState createState() => _mainRegisterPageState();
}
class _mainRegisterPageState extends State<mainRegisterPage> {
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) => getjson(),
));
},
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("CoviDefender"),
),
body: Column(
children: <Widget>[
Expanded(
flex: 1,
child: ButtonTheme(
minWidth: 800.0,
height: 100.0,
child: RaisedButton(
color: Colors.redAccent,
onPressed: () {},
child: Text(
"Registration",
style: TextStyle(color: Colors.white, fontSize: 30),
),
),
)),
Expanded(
flex: 2,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[],
),
),
Expanded(
flex: 5,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
RaisedButton(
color: Colors.white,
onPressed: () {},
child: ClipRRect(
child: Image(
image: AssetImage(
"lib/assets/images/register.gif",
),
),
),
padding: EdgeInsets.symmetric(
vertical: 10.0,
horizontal: 25.0,
),
)
],
),
),
Padding(
padding: EdgeInsets.symmetric(
vertical: 5.0,
horizontal: 15.0,
),
child: Center(
child: Text(
"You have to answer a quiz before register \n Press Start Quiz to navigate.",
style: TextStyle(
fontSize: 30.0,
fontWeight: FontWeight.w900,
),
),
)),
Expanded(
flex: 4,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
RaisedButton(
color: Colors.blueAccent,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20.0)),
onPressed: () {
Navigator.of(context).pushReplacement(MaterialPageRoute(
builder: (context) => splashscreen(),
));
},
child: Text(
"Start Quiz",
style: TextStyle(
fontSize: 30.0,
),
),
padding: EdgeInsets.symmetric(
vertical: 20.0,
horizontal: 200.0,
),
)
],
),
)
],
));
}
}
......@@ -9,23 +9,40 @@ class HeartRateScreen extends StatelessWidget {
appBar: AppBar(
title: Text('Heart Rate Detector'),
),
body: Column(
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Image.asset('lib/assets/images/pulse.gif'),
),
SizedBox(height: 20),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
ElevatedButton(
onPressed: () => Navigator.push(context, MaterialPageRoute(builder: (context) => HomePage(),)),
child: Text('Measure Heart Rate'),
),
],
),
],
body: Container(
color: Colors.white,
child: Column(
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Image.asset('lib/assets/images/pulse.gif'),
),
SizedBox(height: 20),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.fromLTRB(8,70,8,8),
child: SizedBox(
height: 70,
width: 350,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
primary: Colors.red[300],
elevation: 15,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12)
)
),
onPressed: () => Navigator.push(context, MaterialPageRoute(builder: (context) => HomePage(),)),
child: Text('Measure Heart Rate'),
),
),
),
],
),
],
),
),
);
}
......
......@@ -11,23 +11,40 @@ class invoker extends StatelessWidget {
appBar: AppBar(
title: Text('Face Mask Detector'),
),
body: Column(
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Image.asset('lib/assets/images/wear.gif'),
),
SizedBox(height: 20),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
ElevatedButton(
onPressed: () => invokeCamera(),
child: Text('Detect Mask'),
),
],
),
],
body: Container(
color: Colors.white,
child: Column(
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Image.asset('lib/assets/images/wear.gif'),
),
SizedBox(height: 20),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.fromLTRB(8,70,8,8),
child: SizedBox(
height: 70,
width: 350,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
primary: Colors.blue[300],
elevation: 15,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12)
)
),
onPressed: () => invokeCamera(),
child: Text('Detect Mask'),
),
),
),
],
),
],
),
),
);
}
......
// Message model
import 'package:flutter/cupertino.dart';
@immutable
class Message{
final String title;
final String body;
const Message({
@required this.title,
@required this.body,
});
}
\ No newline at end of file
import 'dart:ffi';
import 'package:flutter/material.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'package:oktoast/oktoast.dart';
import 'package:path_provider/path_provider.dart';
import 'dart:io' show File, Platform;
import 'package:http/http.dart' as http;
import 'package:rxdart/subjects.dart';
class NotificationPlugin {
//
FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin;
final BehaviorSubject<ReceivedNotification>
didReceivedLocalNotificationSubject =
BehaviorSubject<ReceivedNotification>();
var initializationSettings;
int awarenessLevel = 0;
NotificationPlugin._() {
init();
}
init() async {
flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin();
if (Platform.isIOS) {
_requestIOSPermission();
}
initializePlatformSpecifics();
}
initializePlatformSpecifics() {
var initializationSettingsAndroid =
AndroidInitializationSettings('app_notf_icon');
var initializationSettingsIOS = IOSInitializationSettings(
requestAlertPermission: true,
requestBadgePermission: true,
requestSoundPermission: false,
onDidReceiveLocalNotification: (id, title, body, payload) async {
ReceivedNotification receivedNotification = ReceivedNotification(
id: id, title: title, body: body, payload: payload);
didReceivedLocalNotificationSubject.add(receivedNotification);
},
);
initializationSettings = InitializationSettings(
initializationSettingsAndroid, initializationSettingsIOS);
}
_requestIOSPermission() {
flutterLocalNotificationsPlugin
.resolvePlatformSpecificImplementation<
IOSFlutterLocalNotificationsPlugin>()
.requestPermissions(
alert: false,
badge: true,
sound: true,
);
}
setListenerForLowerVersions(Function onNotificationInLowerVersions) {
didReceivedLocalNotificationSubject.listen((receivedNotification) {
onNotificationInLowerVersions(receivedNotification);
});
}
setOnNotificationClick(Function onNotificationClick) async {
await flutterLocalNotificationsPlugin.initialize(initializationSettings,
onSelectNotification: (String payload) async {
onNotificationClick(payload);
});
}
Future<void> showNotification() async {
var androidChannelSpecifics = AndroidNotificationDetails(
'CHANNEL_ID',
'CHANNEL_NAME',
"CHANNEL_DESCRIPTION",
importance: Importance.Max,
priority: Priority.High,
playSound: true,
timeoutAfter: 5000,
styleInformation: DefaultStyleInformation(true, true),
);
var iosChannelSpecifics = IOSNotificationDetails();
var platformChannelSpecifics =
NotificationDetails(androidChannelSpecifics, iosChannelSpecifics);
await flutterLocalNotificationsPlugin.show(
0,
'Healthy Tips',
'Always Keep Your Hands Clean !', //null
platformChannelSpecifics,
payload: 'New Payload',
);
}
// Future<void> showDailyAtTime() async {
// var time = Time(21, 3, 0);
// var androidChannelSpecifics = AndroidNotificationDetails(
// 'CHANNEL_ID 4',
// 'CHANNEL_NAME 4',
// "CHANNEL_DESCRIPTION 4",
// importance: Importance.Max,
// priority: Priority.High,
// );
// var iosChannelSpecifics = IOSNotificationDetails();
// var platformChannelSpecifics =
// NotificationDetails(androidChannelSpecifics, iosChannelSpecifics);
// await flutterLocalNotificationsPlugin.showDailyAtTime(
// 0,
// 'Test Title at ${time.hour}:${time.minute}.${time.second}',
// 'Test Body', //null
// time,
// platformChannelSpecifics,
// payload: 'Test Payload',
// );
// }
// Future<void> showWeeklyAtDayTime() async {
// var time = Time(21, 5, 0);
// var androidChannelSpecifics = AndroidNotificationDetails(
// 'CHANNEL_ID 5',
// 'CHANNEL_NAME 5',
// "CHANNEL_DESCRIPTION 5",
// importance: Importance.Max,
// priority: Priority.High,
// );
// var iosChannelSpecifics = IOSNotificationDetails();
// var platformChannelSpecifics =
// NotificationDetails(androidChannelSpecifics, iosChannelSpecifics);
// await flutterLocalNotificationsPlugin.showWeeklyAtDayAndTime(
// 0,
// 'Test Title at ${time.hour}:${time.minute}.${time.second}',
// 'Test Body', //null
// Day.Saturday,
// time,
// platformChannelSpecifics,
// payload: 'Test Payload',
// );
// }
Future<void> repeatNotification() async {
RepeatInterval Freq;
if(awarenessLevel != null ){
print('::: awareness is at :'+awarenessLevel.toString());
if(awarenessLevel >= 0 && awarenessLevel < 2){
Freq = RepeatInterval.EveryMinute;
print('::: awareness is 0 - 2');
}else if(awarenessLevel >= 2 && awarenessLevel < 4){
Freq = RepeatInterval.Hourly;
print('::: awareness is 2 - 3 ');
}else if(awarenessLevel == 4){
Freq = RepeatInterval.Daily;
print('::: awareness is 4');
}else{
showToast(
"Awareness level is not compatible , please try again !",
duration: Duration(seconds: 2),
position: ToastPosition.bottom,
backgroundColor: Colors.black.withOpacity(0.8),
radius: 13.0,
textStyle: TextStyle(fontSize: 18.0),
);
}
}else{
showToast(
"Awareness level is not Availble !",
duration: Duration(seconds: 2),
position: ToastPosition.bottom,
backgroundColor: Colors.black.withOpacity(0.8),
radius: 13.0,
textStyle: TextStyle(fontSize: 18.0),
);
}
var androidChannelSpecifics = AndroidNotificationDetails(
'CHANNEL_ID 3',
'CHANNEL_NAME 3',
"CHANNEL_DESCRIPTION 3",
importance: Importance.Max,
priority: Priority.High,
styleInformation: DefaultStyleInformation(true, true),
);
var iosChannelSpecifics = IOSNotificationDetails();
var platformChannelSpecifics =
NotificationDetails(androidChannelSpecifics, iosChannelSpecifics);
await flutterLocalNotificationsPlugin.periodicallyShow(
0,
'Tips from COVIDEFENDER :D ',
'Always Keep Your Hands Clean !',
Freq,
platformChannelSpecifics,
payload: 'Test Payload',
);
}
// Future<void> scheduleNotification() async {
// var scheduleNotificationDateTime = DateTime.now().add(Duration(seconds: 5));
// var androidChannelSpecifics = AndroidNotificationDetails(
// 'CHANNEL_ID 1',
// 'CHANNEL_NAME 1',
// "CHANNEL_DESCRIPTION 1",
// icon: 'secondary_icon',
// sound: RawResourceAndroidNotificationSound('my_sound'),
// largeIcon: DrawableResourceAndroidBitmap('large_notf_icon'),
// enableLights: true,
// color: const Color.fromARGB(255, 255, 0, 0),
// ledColor: const Color.fromARGB(255, 255, 0, 0),
// ledOnMs: 1000,
// ledOffMs: 500,
// importance: Importance.Max,
// priority: Priority.High,
// playSound: true,
// timeoutAfter: 5000,
// styleInformation: DefaultStyleInformation(true, true),
// );
// var iosChannelSpecifics = IOSNotificationDetails(
// sound: 'my_sound.aiff',
// );
// var platformChannelSpecifics = NotificationDetails(
// androidChannelSpecifics,
// iosChannelSpecifics,
// );
// await flutterLocalNotificationsPlugin.schedule(
// 0,
// 'Test Title',
// 'Test Body',
// scheduleNotificationDateTime,
// platformChannelSpecifics,
// payload: 'Test Payload',
// );
// }
// Future<void> showNotificationWithAttachment() async {
// var attachmentPicturePath = await _downloadAndSaveFile(
// 'https://via.placeholder.com/800x200', 'attachment_img.jpg');
// var iOSPlatformSpecifics = IOSNotificationDetails(
// attachments: [IOSNotificationAttachment(attachmentPicturePath)],
// );
// var bigPictureStyleInformation = BigPictureStyleInformation(
// FilePathAndroidBitmap(attachmentPicturePath),
// contentTitle: '<b>Attached Image</b>',
// htmlFormatContentTitle: true,
// summaryText: 'Test Image',
// htmlFormatSummaryText: true,
// );
// var androidChannelSpecifics = AndroidNotificationDetails(
// 'CHANNEL ID 2',
// 'CHANNEL NAME 2',
// 'CHANNEL DESCRIPTION 2',
// importance: Importance.High,
// priority: Priority.High,
// styleInformation: bigPictureStyleInformation,
// );
// var notificationDetails =
// NotificationDetails(androidChannelSpecifics, iOSPlatformSpecifics);
// await flutterLocalNotificationsPlugin.show(
// 0,
// 'Title with attachment',
// 'Body with Attachment',
// notificationDetails,
// );
// }
// _downloadAndSaveFile(String url, String fileName) async {
// var directory = await getApplicationDocumentsDirectory();
// var filePath = '${directory.path}/$fileName';
// var response = await http.get(url);
// var file = File(filePath);
// await file.writeAsBytes(response.bodyBytes);
// return filePath;
// }
// Future<int> getPendingNotificationCount() async {
// List<PendingNotificationRequest> p =
// await flutterLocalNotificationsPlugin.pendingNotificationRequests();
// return p.length;
// }
// Future<void> cancelNotification() async {
// await flutterLocalNotificationsPlugin.cancel(0);
// }
// Future<void> cancelAllNotification() async {
// await flutterLocalNotificationsPlugin.cancelAll();
// }
}
NotificationPlugin notificationPlugin = NotificationPlugin._();
class ReceivedNotification {
final int id;
final String title;
final String body;
final String payload;
ReceivedNotification({
@required this.id,
@required this.title,
@required this.body,
@required this.payload,
});
}
\ No newline at end of file
import 'package:covidefender/pages/notificator/model/Notification_plugin.dart';
import 'package:flutter/material.dart';
import 'NotificationUI.dart';
class LocalNotificationScreen extends StatefulWidget {
@override
_LocalNotificationScreenState createState() =>
_LocalNotificationScreenState();
}
class _LocalNotificationScreenState extends State<LocalNotificationScreen> {
//
int count = 0;
@override
void initState() {
super.initState();
notificationPlugin
.setListenerForLowerVersions(onNotificationInLowerVersions);
notificationPlugin.setOnNotificationClick(onNotificationClick);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.green,
title: Text('Local Notifications'),
),
body: Center(
child: FlatButton(
onPressed: () async {
await notificationPlugin.showNotification();
// await notificationPlugin.scheduleNotification();
// await notificationPlugin.showNotificationWithAttachment();
await notificationPlugin.repeatNotification();
// await notificationPlugin.showDailyAtTime();
// await notificationPlugin.showWeeklyAtDayTime();
// count = await notificationPlugin.getPendingNotificationCount();
// print('Count $count');
// await notificationPlugin.cancelNotification();
// count = await notificationPlugin.getPendingNotificationCount();
// print('Count $count');
},
child: Text('Send Notification'),
),
),
);
}
onNotificationInLowerVersions(ReceivedNotification receivedNotification) {
print('Notification Received ${receivedNotification.id}');
}
onNotificationClick(String payload) {
print('Payload $payload');
Navigator.push(context, MaterialPageRoute(builder: (coontext) {
return NotificationScreen(
payload: payload,
);
}));
}
}
import 'package:flutter/material.dart';
import 'LocalNotificationUI.dart';
import 'notificator.dart';
class MainNotificationUI extends StatefulWidget {
//
final String payload;
MainNotificationUI({this.payload});
@override
_NotificationScreenState createState() => _NotificationScreenState();
}
class _NotificationScreenState extends State<MainNotificationUI> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.green,
title: Text('Smart Notifier'),
),
body: Center(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisAlignment: MainAxisAlignment.end,
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Image.asset('lib/assets/images/notify.gif'),
),
SizedBox(
child: ElevatedButton(
style: ElevatedButton.styleFrom(
primary: Colors.green[300],
elevation: 15,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12)
)
),
onPressed: (){
Navigator.push(context, MaterialPageRoute(builder: (context) => LocalNotificationScreen() ));
}, child: Text("Local Notifications")),
),
Padding(
padding: const EdgeInsets.fromLTRB(8,8,8,100),
child: SizedBox(
child: ElevatedButton(
style: ElevatedButton.styleFrom(
primary: Colors.green[300],
elevation: 15,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12)
)
),
onPressed: (){
Navigator.push(context, MaterialPageRoute(builder: (context) => MessagingWidget() ));
}, child: Text("Push Notifications")),
),
)
],
),
),
);
}
}
import 'package:flutter/material.dart';
class NotificationScreen extends StatefulWidget {
//
final String payload;
NotificationScreen({this.payload});
@override
_NotificationScreenState createState() => _NotificationScreenState();
}
class _NotificationScreenState extends State<NotificationScreen> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Notifications Screen'),
),
body: Center(
child: Text(widget.payload),
),
);
}
}
import 'dart:ffi';
import 'package:covidefender/pages/notificator/model/Message.dart';
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:flutter/cupertino.dart';
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:flutter/material.dart';
class MessagingWidget extends StatefulWidget {
// const MessagingWidget({Key? key}) : super(key: key);
@override
_MessagingWidgetState createState() => _MessagingWidgetState();
}
class _MessagingWidgetState extends State<MessagingWidget> {
final FirebaseMessaging _firebaseMessaging = FirebaseMessaging();
final List<Message> messages = [];
@override
Void initState() {
super.initState();
_firebaseMessaging.configure(
onMessage: (Map<String, dynamic> message) async {
final notification = message['notification'];
setState(() {
messages.add(
Message(title: notification['title'], body: notification['body']));
});
print("OnMessage: $message");
}, onLaunch: (Map<String, dynamic> message) async {
final notification = message['notification'];
print("onLaunch: $message");
setState(() {
messages.add(
Message(title: notification['title'], body: notification['body']));
});
}, onResume: (Map<String, dynamic> message) async {
print("onResume: $message");
});
}
// @override
// Widget build(BuildContext context) => ListView(
// children: messages.map(buildMessage).toList(),
// );
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.green,
title: Text("Smart - Notificator "),
),
body: Container(
margin: EdgeInsets.only(bottom: 20, left: 10, right: 10, top: 10),
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
color: Colors.blue.withOpacity(0.4),
blurRadius: 8,
offset: Offset(4, 4),
spreadRadius: 5)
],
gradient: LinearGradient(
colors: [Colors.green[600], Colors.white],
begin: Alignment.centerLeft,
end: Alignment.centerRight,
),
borderRadius: BorderRadius.all(Radius.circular(20)),
),
child: ListView(
children: messages.map(buildMessage).toList(),
),
));
}
Widget buildMessage(Message message) => ListTile(
title: Text(
message.title != null ? message.title : "No messages Yet",
style: TextStyle(
color: Colors.white,
fontFamily: 'avenir',
),
),
subtitle: Text(message.body != null ? message.body:"empty"),
);
}
import 'package:covidefender/pages/self_carer/model/MessageSender.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
class SC_medicalResult extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Results'),
),
body: SingleChildScrollView(
child: Container(
color: Colors.white,
child: Column(
children: [
Center(
child: Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height / 2.5,
child: Image.asset('lib/assets/images/lab.gif')),
),
SizedBox(
height: 10,
),
Padding(
padding: const EdgeInsets.all(16.0),
child: Text("Request Medical Officer Support",
style: GoogleFonts.lato(
color: Colors.green,
fontSize: 24,
fontWeight: FontWeight.bold,
letterSpacing: 2)),
),
SizedBox(
height: 10,
),
Padding(
padding: const EdgeInsets.fromLTRB(20,50,50,10),
child: Text(
"I agree To send My Details and location to Medical Officer ",
style: GoogleFonts.adamina(color: Colors.blue,fontSize: 16,fontStyle: FontStyle.italic,wordSpacing: 2),
),
),
SizedBox(
height: 60,
),
SizedBox(
height: 70,
width: 350,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
primary: Colors.red[300],
elevation: 15,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12)
)
),
onPressed: () {
MessageSender m = new MessageSender();
m.SENDSMS();
},
child: Text('SEND SMS',style: GoogleFonts.lato(
fontWeight: FontWeight.bold,
fontSize: 16
),)),
)
],
),
),
),
);
}
}
import 'package:covidefender/pages/self_carer/SC_medicalSupport.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
class SC_resultScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Results'),
),
body: SingleChildScrollView(
child: Container(
color: Colors.white,
child: Column(
children: [
Center(
child: Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height / 2.5,
child: Image.asset('lib/assets/images/lab.gif')),
),
SizedBox(
height: 10,
),
Text("Analysis Results",
style: GoogleFonts.lato(
color: Colors.blue,
fontSize: 24,
fontWeight: FontWeight.bold,
letterSpacing: 2)),
SizedBox(
height: 10,
),
Padding(
padding: const EdgeInsets.fromLTRB(20,50,50,10),
child: Text(
"Seem's you are having Symptoms Related to Covid19.\n"
"Let's Get Medical Assistance ! \n"
"Click Below Button To Get a Health Officer",
style: GoogleFonts.adamina(color: Colors.red ,fontSize: 16,fontStyle: FontStyle.italic,wordSpacing: 2),
),
),
SizedBox(
height: 60,
),
SizedBox(
height: 70,
width: 350,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
primary: Colors.red[300],
elevation: 15,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12)
)
),
onPressed: () {
Navigator.of(context).push(MaterialPageRoute(builder: (context)=>SC_medicalResult()));
},
child: Text('Medical Support',style: GoogleFonts.lato(
fontWeight: FontWeight.bold,
fontSize: 16
),)),
)
],
),
),
),
);
}
}
import 'dart:collection';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_sms/flutter_sms.dart';
class MessageSender {
List<String> recipients= ["+94776957629"];
String Name;
String phoneNumber;
String Address;
String HomePhone;
//
// Map<String,String> myDetails = {
// "Name" : "Indika Nuwan",
// "Address" : "02 nd post ,Mawanella",
// "HomePhone" : "03522444555",
// "message" : "This Patient Need Imediate assistance"
// };
// MessageSender(this.recipients, this.message);
void SENDSMS () async{
print("Executing get data");
final CollectionReference userlist =
FirebaseFirestore.instance.collection("users");
userlist.get().then((datasnapshot){
print("Executing get data ...");
FirebaseFirestore.instance.collection("users").get().then((QuerySnapshot snapshot){
snapshot.docs.forEach((doc) async {
print(doc["Name"]);
print(doc["Address"]);
print(doc["Home phone"]);
print(doc["mobile"]);
Map<String,String> UserDetails = {
"Name" : doc["Name"],
"Address" : doc["Address"],
"HomePhone" : doc["Home phone"],
"message" : "This Patient Need Imediate assistance"
};
print("UserDetails : "+UserDetails.toString());
String result = await sendSMS(message: UserDetails.toString(), recipients: recipients).catchError((onError)=>print(onError));
print("result");
});
});
});
}
}
import 'dart:ui';
class Symptoms {
String symptomname;
bool value;
List<Color> gradientColors;
Symptoms(this.symptomname, this.value,{this.gradientColors});
@override
String toString() {
return 'Symptoms{symptomname: $symptomname, value: $value}';
}
}
\ No newline at end of file
import 'package:flutter/material.dart';
class CustomColors {
static Color primaryTextColor = Colors.white;
static Color dividerColor = Colors.white54;
static Color pageBackgroundColor = Color(0xFF2D2F41);
static Color menuBackgroundColor = Color(0xFF242634);
static Color clockBG = Color(0xFF444974);
static Color clockOutline = Color(0xFFEAECFF);
static Color secHandColor = Colors.orange[300];
static Color minHandStatColor = Color(0xFF748EF6);
static Color minHandEndColor = Color(0xFF77DDFF);
static Color hourHandStatColor = Color(0xFFC279FB);
static Color hourHandEndColor = Color(0xFFEA74AB);
}
class GradientColors {
final List<Color> colors;
GradientColors(this.colors);
static List<Color> sky = [Color(0xFF6448FE), Color(0xFF5FC6FF)];
static List<Color> sunset = [Color(0xFFFE6197), Color(0xFFFFB463)];
static List<Color> sea = [Color(0xFF61A3FE), Color(0xFF63FFD5)];
static List<Color> mango = [Color(0xFFFFA738), Color(0xFFFFE130)];
static List<Color> fire = [Color(0xFFFF5DCD), Color(0xFFFF8484)];
}
class GradientTemplate {
static List<GradientColors> gradientTemplate = [
GradientColors(GradientColors.sky),
GradientColors(GradientColors.sunset),
GradientColors(GradientColors.sea),
GradientColors(GradientColors.mango),
GradientColors(GradientColors.fire),
];
}
import 'dart:collection';
import 'package:covidefender/pages/self_carer/SC_result_screen.dart';
import 'package:covidefender/pages/self_carer/model/colors.dart';
import 'package:flutter/material.dart';
import 'package:quiver/collection.dart';
import 'model/Symptoms.dart';
class SC_main extends StatefulWidget {
@override
SC_mainState createState() => SC_mainState();
}
class SC_mainState extends State<SC_main> {
bool isPositiveMatch = false;
// String symptom = "i am a symptom";
// HashMap symptomMap = new HashMap<int,String>();
Map<String, bool> symptomList = HashMap();
Map<String, bool> values = {
'Fever With Chills': false,
'Cough and Sneezing': false,
'Difficulty in Breathing': false,
'Sore throat / Blush lips': false,
'Mustle Pain or Ache': false,
};
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Self-Carer"),
),
body: Container(
child: SingleChildScrollView(
child: Column(
children: [
Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height /2.5,
child: Image.asset(
'lib/assets/images/hospital.gif',
)),
SizedBox(
height: 350,
child: new ListView(
children: values.keys.map((String key) {
return Container(
margin: EdgeInsets.only(bottom: 20,left: 10,right: 10),
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
color: Colors.blue.withOpacity(0.4) ,blurRadius: 8, offset: Offset(4,4),spreadRadius: 4
)
],
gradient: LinearGradient(
colors: [Colors.blue[600], Colors.white],
begin: Alignment.centerLeft,
end: Alignment.centerRight,
),
borderRadius: BorderRadius.all(Radius.circular(24)),
),
child: SizedBox(
height: 90,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: new CheckboxListTile(
title: new Text(key,style:TextStyle(
color: Colors.white,
fontFamily: 'avenir',
),),
value: values[key],
onChanged: (bool value) {
setState(() {
values[key] = value;
symptomList.clear();
values.forEach((key, value) {
print('${key}: ${value}');
if (value) {
symptomList.putIfAbsent(key, () => value);
print(
'Selected Items::' + symptomList.toString());
}
});
});
print(key);
},
),
),
),
);
}).toList(),
),
),
],
),
),
),
floatingActionButton: FloatingActionButton(
onPressed: () => {
if (symptomList.isEmpty)
{print("Please select your Symptoms")}
else
{
if(symptomList.containsKey('Fever With Chills')
&& symptomList.containsKey('Cough and Sneezing')
&& symptomList.containsKey('Difficulty in Breathing')
&& symptomList.containsKey('Sore throat / Blush lips')
&& symptomList.containsKey('Mustle Pain or Ache')){
print("Positive Match Found Immediate Treatements needed !"),
Navigator.push(context,
MaterialPageRoute(builder: (context) => SC_resultScreen()))
}
}
},
child: Icon(
// Icons.next_plan_outlined
Icons.double_arrow_rounded)),
);
}
}
......@@ -7,7 +7,7 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.5.0"
version: "2.6.1"
boolean_selector:
dependency: transitive
description:
......@@ -148,6 +148,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.2"
flutter_polyline_points:
dependency: "direct main"
description:
name: flutter_polyline_points
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.4"
flutter_spinkit:
dependency: "direct main"
description:
......@@ -172,6 +179,48 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
font_awesome_flutter:
dependency: "direct main"
description:
name: font_awesome_flutter
url: "https://pub.dartlang.org"
source: hosted
version: "9.1.0"
geocoding:
dependency: "direct main"
description:
name: geocoding
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.5"
geocoding_platform_interface:
dependency: transitive
description:
name: geocoding_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1+1"
geolocator:
dependency: "direct main"
description:
name: geolocator
url: "https://pub.dartlang.org"
source: hosted
version: "6.2.1"
geolocator_platform_interface:
dependency: transitive
description:
name: geolocator_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.9"
geolocator_web:
dependency: transitive
description:
name: geolocator_web
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
google_maps_flutter:
dependency: "direct main"
description:
......@@ -359,6 +408,48 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
url_launcher:
dependency: transitive
description:
name: url_launcher
url: "https://pub.dartlang.org"
source: hosted
version: "5.7.10"
url_launcher_linux:
dependency: transitive
description:
name: url_launcher_linux
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.1+4"
url_launcher_macos:
dependency: transitive
description:
name: url_launcher_macos
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.1+9"
url_launcher_platform_interface:
dependency: transitive
description:
name: url_launcher_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.9"
url_launcher_web:
dependency: transitive
description:
name: url_launcher_web
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.5+3"
url_launcher_windows:
dependency: transitive
description:
name: url_launcher_windows
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.1+3"
vector_math:
dependency: transitive
description:
......
......@@ -33,8 +33,12 @@ dependencies:
wakelock: ^0.1.4+1
charts_flutter: ^0.9.0
flutter_spinkit: "^4.1.2"
google_fonts: ^1.1.2
flutter_sms: ^2.1.1
firebase_messaging: ^4.0.0+1
rxdart: ^0.24.1
path_provider: ^1.6.11
flutter_local_notifications: ^1.4.4+1
# The following adds the Cupertino Icons font to your application.
......@@ -42,17 +46,18 @@ dependencies:
cupertino_icons: ^1.0.2
http: ^0.12.2
#add dependencies for heart rate module
#add dependencies for heart rate module
camera:
git:
url: http://github.com/indikaNK/plugins.git
path: packages/camera/camera
google_maps_flutter: ^2.0.6
font_awesome_flutter: ^9.1.0
flutter_polyline_points: ^0.2.4
geocoding: ^1.0.5
geolocator: ^6.2.1
dev_dependencies:
......@@ -116,6 +121,28 @@ flutter:
- lib/assets/images/4.png
- lib/assets/images/5.png
- lib/assets/images/6.png
- lib/assets/images/100.png
- lib/assets/images/200.png
- lib/assets/images/300.png
- lib/assets/images/400.png
- lib/assets/images/500.png
- lib/assets/images/start.gif
- lib/assets/images/handWashingStart.gif
- lib/assets/images/maskWearingStart.gif
- lib/assets/images/publicPlacesStart.gif
- lib/assets/images/socialDistanceStart.gif
- lib/assets/images/symStart1.gif
- lib/assets/images/symStart2.gif
- lib/assets/images/symStart3.gif
- lib/assets/images/symStart4.gif
- lib/assets/images/gameover.gif
- lib/assets/images/finalResult.gif
- lib/assets/images/awarenessLevel.gif
- lib/assets/images/login.gif
- lib/assets/images/register.gif
- lib/assets/images/corona.gif
- lib/assets/images/quizImage.gif
- lib/assets/images/result.png
- lib/assets/images/hero.gif
- lib/assets/images/map80.png
......@@ -129,6 +156,9 @@ flutter:
- lib/assets/labels.txt
- assets/
- lib/assets/images/wear.gif
- lib/assets/images/hospital.gif
- lib/assets/images/lab.gif
- lib/assets/images/notify.gif
# To add assets to your application, add an assets section, like this:
# assets:
......
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