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

Merge branch 'SRouter_map_Ranaweera' into 'develop_1'

router final update

See merge request !23
parents 15008cc1 f2944e44
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.covidefender"> package="com.example.covidefender">
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application <application
android:label="covidefender" android:label="covidefender"
android:icon="@mipmap/ic_launcher"> android:icon="@mipmap/ic_launcher">
<meta-data android:name="com.google.android.geo.API_KEY"
android:value="AIzaSyBuDih9ioyQAR9ikg3zEoE_5mhXvZh5oAw"/>
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"
android:launchMode="singleTop" android:launchMode="singleTop"
......
...@@ -7,44 +7,45 @@ class AddLocation extends StatefulWidget { ...@@ -7,44 +7,45 @@ class AddLocation extends StatefulWidget {
} }
class AddLocationState extends State<AddLocation> { class AddLocationState extends State<AddLocation> {
String userName;
String phoneNumber;
String riskLocation;
String hotelName;
String date;
String time;
getUserName(name) {
this.userName = name;
}
String userName; getPhoneNumber(pno) {
String phoneNumber; this.phoneNumber = pno;
String riskLocation; }
String hotelName;
String date;
String time;
getUserName(name){
this.userName= name;
}
getPhoneNumber(pno){ getRiskLocation(location) {
this.phoneNumber= pno; this.riskLocation = location;
} }
getRiskLocation(location){ getHotelName(hotelname) {
this.riskLocation= location; this.hotelName = hotelname;
} }
getHotelName(hotelname){ getDate(date) {
this.hotelName= hotelname; this.date = date;
} }
getDate(date){ getTime(time) {
this.date= date; this.time = time;
} }
getTime(time){
this.time= time;
}
//---------------------------------------------Create Data----------------------------------------------------- //---------------------------------------------Create Data-----------------------------------------------------
createData(){ createData() {
print("object"); print("object");
DocumentReference documentReference = Firestore.instance.collection("RiskLocation").document(userName); DocumentReference documentReference =
Firestore.instance.collection("RiskLocation").document(userName);
Map<String, dynamic> locations ={ Map<String, dynamic> locations = {
"userName": userName, "userName": userName,
"phoneNumber": phoneNumber, "phoneNumber": phoneNumber,
"riskLocation": riskLocation, "riskLocation": riskLocation,
...@@ -56,16 +57,15 @@ createData(){ ...@@ -56,16 +57,15 @@ createData(){
documentReference.setData(locations).whenComplete(() { documentReference.setData(locations).whenComplete(() {
print("$userName created"); print("$userName created");
}); });
}
}
//---------------------------------------------Read Data----------------------------------------------------- //---------------------------------------------Read Data-----------------------------------------------------
readData() {
DocumentReference documentReference =
Firestore.instance.collection("RiskLocation").document(userName);
readData(){ documentReference.get().then((datasnapshot) {
DocumentReference documentReference = Firestore.instance.collection("RiskLocation").document(userName);
documentReference.get().then((datasnapshot){
print(datasnapshot.data()["userName"]); print(datasnapshot.data()["userName"]);
print(datasnapshot.data()["phoneNumber"]); print(datasnapshot.data()["phoneNumber"]);
print(datasnapshot.data()["riskLocation"]); print(datasnapshot.data()["riskLocation"]);
...@@ -73,16 +73,17 @@ readData(){ ...@@ -73,16 +73,17 @@ readData(){
print(datasnapshot.data()["date"]); print(datasnapshot.data()["date"]);
print(datasnapshot.data()["time"]); print(datasnapshot.data()["time"]);
}); });
} }
//---------------------------------------------Update Data----------------------------------------------------- //---------------------------------------------Update Data-----------------------------------------------------
updateData(){ updateData() {
print("object"); print("object");
DocumentReference documentReference = Firestore.instance.collection("RiskLocation").document(userName); DocumentReference documentReference =
Firestore.instance.collection("RiskLocation").document(userName);
Map<String, dynamic> locations ={ Map<String, dynamic> locations = {
"userName": userName, "userName": userName,
"phoneNumber": phoneNumber, "phoneNumber": phoneNumber,
"riskLocation": riskLocation, "riskLocation": riskLocation,
...@@ -94,23 +95,24 @@ updateData(){ ...@@ -94,23 +95,24 @@ updateData(){
documentReference.setData(locations).whenComplete(() { documentReference.setData(locations).whenComplete(() {
print("$userName Updated"); print("$userName Updated");
}); });
} }
//---------------------------------------------Delete Data----------------------------------------------------- //---------------------------------------------Delete Data-----------------------------------------------------
deleteData(){ deleteData() {
DocumentReference documentReference = Firestore.instance.collection("RiskLocation").document(userName); DocumentReference documentReference =
documentReference.delete().whenComplete((){ Firestore.instance.collection("RiskLocation").document(userName);
documentReference.delete().whenComplete(() {
print("$userName Deleted"); print("$userName Deleted");
}); });
} }
final GlobalKey<FormState> _formKey = GlobalKey<FormState>(); final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
//---------------------------------------------User Name----------------------------------------------------- //---------------------------------------------User Name-----------------------------------------------------
Widget _buildName(){ Widget _buildName() {
return TextFormField( return TextFormField(
decoration: InputDecoration(labelText: 'Full Name'), decoration: InputDecoration(labelText: 'Full Name'),
validator: (String value){ validator: (String value) {
if (value.isEmpty) { if (value.isEmpty) {
return '*Full Name is Required'; return '*Full Name is Required';
} }
...@@ -118,19 +120,19 @@ Widget _buildName(){ ...@@ -118,19 +120,19 @@ Widget _buildName(){
// onSaved: (String value){ // onSaved: (String value){
// _fName = value; // _fName = value;
// }, // },
onChanged: (String name){ onChanged: (String name) {
getUserName(name); getUserName(name);
}, },
); );
} }
//---------------------------------------------Phone Number----------------------------------------------------- //---------------------------------------------Phone Number-----------------------------------------------------
Widget _buildPNo(){ Widget _buildPNo() {
return TextFormField( return TextFormField(
decoration: InputDecoration(labelText: 'Phone Number'), decoration: InputDecoration(labelText: 'Phone Number'),
keyboardType: TextInputType.phone, keyboardType: TextInputType.phone,
maxLength: 10, maxLength: 10,
validator: (String value){ validator: (String value) {
if (value.isEmpty) { if (value.isEmpty) {
return '*Phone Number is Required'; return '*Phone Number is Required';
} }
...@@ -138,17 +140,17 @@ Widget _buildPNo(){ ...@@ -138,17 +140,17 @@ Widget _buildPNo(){
// onSaved: (String value){ // onSaved: (String value){
// _lName = value; // _lName = value;
// }, // },
onChanged: (String id){ onChanged: (String id) {
getPhoneNumber(phoneNumber); getPhoneNumber(phoneNumber);
}, },
); );
} }
//---------------------------------------------Risk Location----------------------------------------------------- //---------------------------------------------Risk Location-----------------------------------------------------
Widget _buildLocation(){ Widget _buildLocation() {
return TextFormField( return TextFormField(
decoration: InputDecoration(labelText: 'Risk Location'), decoration: InputDecoration(labelText: 'Risk Location'),
validator: (String value){ validator: (String value) {
if (value.isEmpty) { if (value.isEmpty) {
return '*Risk Location is Required'; return '*Risk Location is Required';
} }
...@@ -156,17 +158,17 @@ Widget _buildLocation(){ ...@@ -156,17 +158,17 @@ Widget _buildLocation(){
// onSaved: (String value){ // onSaved: (String value){
// _age = value; // _age = value;
// }, // },
onChanged: (String riskLocation){ onChanged: (String riskLocation) {
getRiskLocation(riskLocation); getRiskLocation(riskLocation);
}, },
); );
} }
//---------------------------------------------Hotel Name----------------------------------------------------- //---------------------------------------------Hotel Name-----------------------------------------------------
Widget _buildHotelName(){ Widget _buildHotelName() {
return TextFormField( return TextFormField(
decoration: InputDecoration(labelText: 'Hotel Name'), decoration: InputDecoration(labelText: 'Hotel Name'),
validator: (String value){ validator: (String value) {
if (value.isEmpty) { if (value.isEmpty) {
return '*Hotel Name is Required'; return '*Hotel Name is Required';
} }
...@@ -174,17 +176,17 @@ Widget _buildHotelName(){ ...@@ -174,17 +176,17 @@ Widget _buildHotelName(){
// onSaved: (String value){ // onSaved: (String value){
// _address = value; // _address = value;
// }, // },
onChanged: (String hotelName){ onChanged: (String hotelName) {
getHotelName(hotelName); getHotelName(hotelName);
}, },
); );
} }
//---------------------------------------------Date----------------------------------------------------- //---------------------------------------------Date-----------------------------------------------------
Widget _buildDate(){ Widget _buildDate() {
return TextFormField( return TextFormField(
decoration: InputDecoration(labelText: 'Date'), decoration: InputDecoration(labelText: 'Date'),
validator: (String value){ validator: (String value) {
if (value.isEmpty) { if (value.isEmpty) {
return '*Date is Required'; return '*Date is Required';
} }
...@@ -192,17 +194,17 @@ Widget _buildDate(){ ...@@ -192,17 +194,17 @@ Widget _buildDate(){
// onSaved: (String value){ // onSaved: (String value){
// _nic = value; // _nic = value;
// }, // },
onChanged: (String date){ onChanged: (String date) {
getDate(date); getDate(date);
}, },
); );
} }
//---------------------------------------------Time----------------------------------------------------- //---------------------------------------------Time-----------------------------------------------------
Widget _buildTime(){ Widget _buildTime() {
return TextFormField( return TextFormField(
decoration: InputDecoration(labelText: 'Time'), decoration: InputDecoration(labelText: 'Time'),
validator: (String value){ validator: (String value) {
if (value.isEmpty) { if (value.isEmpty) {
return '*Time is Required'; return '*Time is Required';
} }
...@@ -210,12 +212,11 @@ Widget _buildTime(){ ...@@ -210,12 +212,11 @@ Widget _buildTime(){
// onSaved: (String value){ // onSaved: (String value){
// _phoneNumber = value; // _phoneNumber = value;
// }, // },
onChanged: (String time){ onChanged: (String time) {
getTime(time); getTime(time);
}, },
); );
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
...@@ -240,7 +241,6 @@ Widget _buildTime(){ ...@@ -240,7 +241,6 @@ Widget _buildTime(){
_buildDate(), _buildDate(),
_buildTime(), _buildTime(),
SizedBox(height: 100), SizedBox(height: 100),
RaisedButton( RaisedButton(
color: Colors.green, color: Colors.green,
...@@ -249,14 +249,12 @@ Widget _buildTime(){ ...@@ -249,14 +249,12 @@ Widget _buildTime(){
style: TextStyle(color: Colors.white, fontSize: 18), style: TextStyle(color: Colors.white, fontSize: 18),
), ),
onPressed: () { onPressed: () {
if(!_formKey.currentState.validate()) { if (!_formKey.currentState.validate()) {
return; return;
} }
createData(); createData();
},
} ,
), ),
// RaisedButton( // RaisedButton(
...@@ -279,10 +277,8 @@ Widget _buildTime(){ ...@@ -279,10 +277,8 @@ Widget _buildTime(){
style: TextStyle(color: Colors.white, fontSize: 18), style: TextStyle(color: Colors.white, fontSize: 18),
), ),
onPressed: () { onPressed: () {
updateData(); updateData();
},
} ,
), ),
RaisedButton( RaisedButton(
...@@ -292,17 +288,12 @@ Widget _buildTime(){ ...@@ -292,17 +288,12 @@ Widget _buildTime(){
style: TextStyle(color: Colors.white, fontSize: 18), style: TextStyle(color: Colors.white, fontSize: 18),
), ),
onPressed: () { onPressed: () {
deleteData(); deleteData();
},
} ,
), ),
], ],
),), ),
),
), ),
); );
} }
......
This diff is collapsed.
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),
),
),
),
),
],
),
);
}
}
This diff is collapsed.
class SecrectMapKey {
// Add your Google Maps API Key here
static const API_KEY = 'AIzaSyBuDih9ioyQAR9ikg3zEoE_5mhXvZh5oAw';
}
This diff is collapsed.
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),
),
),
),
),
],
),
);
}
}
import 'package:covidefender/I_GUIDER/splashIguider.dart'; import 'package:covidefender/I_GUIDER/splashIguider.dart';
import 'package:covidefender/SRouter/srouterDashboard.dart';
import 'package:covidefender/STracker/splash.dart'; import 'package:covidefender/STracker/splash.dart';
import 'package:covidefender/EAnalyzer/Loading.dart'; import 'package:covidefender/EAnalyzer/Loading.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
...@@ -95,13 +96,18 @@ class _HomeScreenState extends State<HomeScreen> { ...@@ -95,13 +96,18 @@ class _HomeScreenState extends State<HomeScreen> {
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[ children: <Widget>[
Container( FlatButton(
height: size.height * .1, onPressed: () {
decoration: BoxDecoration( Navigator.push(
image: DecorationImage( context,
image: AssetImage( MaterialPageRoute(
'lib/assets/images/map80.png')), builder: (context) =>
)), SrouterDashboard()),
);
},
child: Image.asset(
'lib/assets/images/map80.png'),
),
Text('Map', style: TextStyle(fontSize: 20.0)) Text('Map', style: TextStyle(fontSize: 20.0))
], ],
)), )),
......
...@@ -7,7 +7,7 @@ packages: ...@@ -7,7 +7,7 @@ packages:
name: async name: async
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.5.0" version: "2.6.1"
boolean_selector: boolean_selector:
dependency: transitive dependency: transitive
description: description:
...@@ -141,6 +141,20 @@ packages: ...@@ -141,6 +141,20 @@ packages:
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
flutter_plugin_android_lifecycle:
dependency: transitive
description:
name: flutter_plugin_android_lifecycle
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: flutter_spinkit:
dependency: "direct main" dependency: "direct main"
description: description:
...@@ -165,6 +179,62 @@ packages: ...@@ -165,6 +179,62 @@ packages:
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" 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:
name: google_maps_flutter
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.6"
google_maps_flutter_platform_interface:
dependency: transitive
description:
name: google_maps_flutter_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
http: http:
dependency: "direct main" dependency: "direct main"
description: description:
...@@ -338,6 +408,48 @@ packages: ...@@ -338,6 +408,48 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.3.0" 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: vector_math:
dependency: transitive dependency: transitive
description: description:
......
...@@ -51,6 +51,11 @@ dependencies: ...@@ -51,6 +51,11 @@ dependencies:
git: git:
url: http://github.com/indikaNK/plugins.git url: http://github.com/indikaNK/plugins.git
path: packages/camera/camera 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: dev_dependencies:
......
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