Commit f2944e44 authored by duranka-kads's avatar duranka-kads

router final update

parent 15008cc1
<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"/>
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
......
......@@ -7,44 +7,45 @@ 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(){
createData() {
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,
"phoneNumber": phoneNumber,
"riskLocation": riskLocation,
......@@ -56,16 +57,15 @@ createData(){
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"]);
......@@ -73,16 +73,17 @@ readData(){
print(datasnapshot.data()["date"]);
print(datasnapshot.data()["time"]);
});
}
}
//---------------------------------------------Update Data-----------------------------------------------------
updateData(){
updateData() {
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,
"phoneNumber": phoneNumber,
"riskLocation": riskLocation,
......@@ -94,23 +95,24 @@ updateData(){
documentReference.setData(locations).whenComplete(() {
print("$userName Updated");
});
}
}
//---------------------------------------------Delete Data-----------------------------------------------------
deleteData(){
DocumentReference documentReference = Firestore.instance.collection("RiskLocation").document(userName);
documentReference.delete().whenComplete((){
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(){
Widget _buildName() {
return TextFormField(
decoration: InputDecoration(labelText: 'Full Name'),
validator: (String value){
validator: (String value) {
if (value.isEmpty) {
return '*Full Name is Required';
}
......@@ -118,19 +120,19 @@ Widget _buildName(){
// onSaved: (String value){
// _fName = value;
// },
onChanged: (String name){
onChanged: (String name) {
getUserName(name);
},
);
}
}
//---------------------------------------------Phone Number-----------------------------------------------------
Widget _buildPNo(){
Widget _buildPNo() {
return TextFormField(
decoration: InputDecoration(labelText: 'Phone Number'),
keyboardType: TextInputType.phone,
maxLength: 10,
validator: (String value){
validator: (String value) {
if (value.isEmpty) {
return '*Phone Number is Required';
}
......@@ -138,17 +140,17 @@ Widget _buildPNo(){
// onSaved: (String value){
// _lName = value;
// },
onChanged: (String id){
onChanged: (String id) {
getPhoneNumber(phoneNumber);
},
);
}
}
//---------------------------------------------Risk Location-----------------------------------------------------
Widget _buildLocation(){
Widget _buildLocation() {
return TextFormField(
decoration: InputDecoration(labelText: 'Risk Location'),
validator: (String value){
validator: (String value) {
if (value.isEmpty) {
return '*Risk Location is Required';
}
......@@ -156,17 +158,17 @@ Widget _buildLocation(){
// onSaved: (String value){
// _age = value;
// },
onChanged: (String riskLocation){
onChanged: (String riskLocation) {
getRiskLocation(riskLocation);
},
);
}
}
//---------------------------------------------Hotel Name-----------------------------------------------------
Widget _buildHotelName(){
Widget _buildHotelName() {
return TextFormField(
decoration: InputDecoration(labelText: 'Hotel Name'),
validator: (String value){
validator: (String value) {
if (value.isEmpty) {
return '*Hotel Name is Required';
}
......@@ -174,17 +176,17 @@ Widget _buildHotelName(){
// onSaved: (String value){
// _address = value;
// },
onChanged: (String hotelName){
onChanged: (String hotelName) {
getHotelName(hotelName);
},
);
}
}
//---------------------------------------------Date-----------------------------------------------------
Widget _buildDate(){
Widget _buildDate() {
return TextFormField(
decoration: InputDecoration(labelText: 'Date'),
validator: (String value){
validator: (String value) {
if (value.isEmpty) {
return '*Date is Required';
}
......@@ -192,17 +194,17 @@ Widget _buildDate(){
// onSaved: (String value){
// _nic = value;
// },
onChanged: (String date){
onChanged: (String date) {
getDate(date);
},
);
}
}
//---------------------------------------------Time-----------------------------------------------------
Widget _buildTime(){
Widget _buildTime() {
return TextFormField(
decoration: InputDecoration(labelText: 'Time'),
validator: (String value){
validator: (String value) {
if (value.isEmpty) {
return '*Time is Required';
}
......@@ -210,12 +212,11 @@ Widget _buildTime(){
// onSaved: (String value){
// _phoneNumber = value;
// },
onChanged: (String time){
onChanged: (String time) {
getTime(time);
},
);
}
}
@override
Widget build(BuildContext context) {
......@@ -240,7 +241,6 @@ Widget _buildTime(){
_buildDate(),
_buildTime(),
SizedBox(height: 100),
RaisedButton(
color: Colors.green,
......@@ -249,14 +249,12 @@ Widget _buildTime(){
style: TextStyle(color: Colors.white, fontSize: 18),
),
onPressed: () {
if(!_formKey.currentState.validate()) {
if (!_formKey.currentState.validate()) {
return;
}
createData();
} ,
},
),
// RaisedButton(
......@@ -279,10 +277,8 @@ Widget _buildTime(){
style: TextStyle(color: Colors.white, fontSize: 18),
),
onPressed: () {
updateData();
} ,
},
),
RaisedButton(
......@@ -292,17 +288,12 @@ Widget _buildTime(){
style: TextStyle(color: Colors.white, fontSize: 18),
),
onPressed: () {
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/SRouter/srouterDashboard.dart';
import 'package:covidefender/STracker/splash.dart';
import 'package:covidefender/EAnalyzer/Loading.dart';
import 'package:flutter/material.dart';
......@@ -95,13 +96,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))
],
)),
......
......@@ -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:
......@@ -141,6 +141,20 @@ packages:
description: flutter
source: sdk
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:
dependency: "direct main"
description:
......@@ -165,6 +179,62 @@ 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:
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:
dependency: "direct main"
description:
......@@ -338,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:
......
......@@ -51,6 +51,11 @@ dependencies:
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:
......
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