Commit 8f94e6aa authored by GayaniPKarunaratne's avatar GayaniPKarunaratne

Change some codes in hotelmap dart file

parent 7aceccb6
......@@ -4,7 +4,7 @@
android:label="covidefender"
android:icon="@mipmap/ic_launcher">
<meta-data android:name="com.google.android.geo.API_KEY"
android:value=""/>
android:value="AIzaSyBuDih9ioyQAR9ikg3zEoE_5mhXvZh5oAw"/>
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
......
......@@ -3,6 +3,7 @@ import 'package:covidefender/EAnalyzer/HotelMap.dart';
import 'package:covidefender/EAnalyzer/SearchEvent.dart';
import 'package:flutter/material.dart';
import 'AddLocation.dart';
import 'RiskEventList.dart';
class EAnalyzerDash extends StatelessWidget {
@override
......@@ -108,7 +109,7 @@ class EAnalyzerDash extends StatelessWidget {
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => EAnalyzerDash()),
MaterialPageRoute(builder: (context) => RiskEventList()),
);
},
child: Image.asset('lib/assets/images/list80.png'),
......
......@@ -72,6 +72,9 @@ class _HospitalDetailsState extends State<HospitalDetails> {
padding: const EdgeInsets.all(12.0),
child: Row(
children: <Widget>[
// CircleAvatar(
// ),
Padding(
padding: const EdgeInsets.all(12.0),
child: Text("Hospital ID: ${userData[index]["hospital_id"]}\n${userData[index]["hospital"]["name"]}\n${userData[index]["hospital"]["name_si"]}\n\nTotal Patients: ${userData[index]["cumulative_total"]}\nDate/Time: ${userData[index]["created_at"]}",
......
......@@ -23,8 +23,9 @@ class _HotelMapState extends State<HotelMap> {
child: GoogleMap(
initialCameraPosition: CameraPosition(
target: LatLng(40.7128, -74.0060),
zoom: 20.0,
target: LatLng(7.8731, 80.7718),
zoom: 8.0,
),
),
),
......
import 'package:flutter/material.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart';
class RiskEventList extends StatefulWidget {
const RiskEventList({ Key key }) : super(key: key);
@override
_RiskEventListState createState() => _RiskEventListState();
}
class _RiskEventListState extends State<RiskEventList> {
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: AppBar(
backwardsCompatibility: false,
backgroundColor: Color(0xFF1B5E20),
title: Text("Search Risk Hotels"),
),
body: ListPage(),
);
}
}
class ListPage extends StatefulWidget {
@override
_ListPageState createState() => _ListPageState();
}
class _ListPageState extends State<ListPage> {
Future _data;
Future getRiskLocation() async {
var firestore = Firestore.instance;
QuerySnapshot qn = await firestore.collection("RiskLocation").getDocuments();
return qn.documents;
}
navigateToDetail(DocumentSnapshot riskLocation){
Navigator.push(context, MaterialPageRoute(builder: (context) => DetailPage(riskLocation: riskLocation,)));
}
@override
void initState() {
// TODO: implement initState
super.initState();
_data = getRiskLocation();
}
@override
Widget build(BuildContext context) {
return Container(
child: FutureBuilder(
future: _data,
// ignore: missing_return
builder:(_, snapshot){
if (snapshot.connectionState == ConnectionState.waiting) {
return Center(
child: SpinKitFadingCircle(
color: Colors.green,
size: 80.0,
),
);
}else{
return ListView.builder(
itemCount: snapshot.data.length,
itemBuilder: (_, index){
return Card(
elevation: 8,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15.0),
),
color: Colors.lightGreen[100],
child: ListTile(
leading: Icon(Icons.location_city, size: 40),
title: Text(snapshot.data[index].data()["hotelName"],style: TextStyle(fontSize: 20.0,fontWeight: FontWeight.bold),),
subtitle: Text(snapshot.data[index].data()["riskLocation"],style: TextStyle(fontSize: 16.0),),
onTap: () => navigateToDetail(snapshot.data[index]),
),
);
});
}
} ),
);
}
}
class DetailPage extends StatefulWidget {
final DocumentSnapshot riskLocation;
DetailPage({this.riskLocation});
@override
_DetailPageState createState() => _DetailPageState();
}
class _DetailPageState extends State<DetailPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backwardsCompatibility: false,
backgroundColor: Color(0xFF1B5E20),
title: Text(widget.riskLocation.data()["hotelName"]),
),
body: Container(
width: MediaQuery.of(context).size.width,
height: 100,
child: Card(
elevation: 8,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20.0),
),
color: Colors.lightGreen[50],
child: ListTile(
leading: Icon(Icons.timelapse, size: 40),
title: Text("Date : ${widget.riskLocation.data()["date"]}" ,style: TextStyle(fontSize: 20.0,fontWeight: FontWeight.bold),),
subtitle: Text("Time : ${widget.riskLocation.data()["time"]}",style: TextStyle(fontSize: 20.0,fontWeight: FontWeight.bold),),
),
),
),
);
}
}
import 'package:flutter/material.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart';
class SearchEvent extends StatefulWidget {
const SearchEvent({ Key key }) : super(key: key);
@override
_SearchEventState createState() => _SearchEventState();
}
class _SearchEventState extends State<SearchEvent> {
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: AppBar(
backwardsCompatibility: false,
backgroundColor: Color(0xFF1B5E20),
title: Text("Search Risk Hotels"),
),
body: ListPage(),
);
}
}
class ListPage extends StatefulWidget {
@override
_ListPageState createState() => _ListPageState();
}
class _ListPageState extends State<ListPage> {
String hotelName;
String district;
int nearToDistrict;
int noOfPeople;
String date;
// int ima;
Future _data;
// void riskLevel(){
// ima = 200;
// print('Test');
// }
Future getRiskLocation() async {
var firestore = Firestore.instance;
QuerySnapshot qn = await firestore.collection("RiskLocation").getDocuments();
getHotelName(hotelName){
this.hotelName= hotelName;
}
return qn.documents;
getDistrict(district){
this.district= district;
}
navigateToDetail(DocumentSnapshot riskLocation){
Navigator.push(context, MaterialPageRoute(builder: (context) => DetailPage(riskLocation: riskLocation,)));
getNearDistrict(nearToDistrict){
this.nearToDistrict= nearToDistrict;
}
@override
void initState() {
// TODO: implement initState
super.initState();
_data = getRiskLocation();
getPeople(noOfPeople){
this.noOfPeople= noOfPeople;
}
@override
Widget build(BuildContext context) {
return Container(
child: FutureBuilder(
future: _data,
// ignore: missing_return
builder:(_, snapshot){
if (snapshot.connectionState == ConnectionState.waiting) {
return Center(
child: SpinKitFadingCircle(
color: Colors.green,
size: 80.0,
),
);
}else{
return ListView.builder(
itemCount: snapshot.data.length,
itemBuilder: (_, index){
return Card(
elevation: 8,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15.0),
),
color: Colors.lightGreen[100],
child: ListTile(
leading: Icon(Icons.location_city, size: 40),
title: Text(snapshot.data[index].data()["hotelName"],style: TextStyle(fontSize: 20.0,fontWeight: FontWeight.bold),),
subtitle: Text(snapshot.data[index].data()["riskLocation"],style: TextStyle(fontSize: 16.0),),
onTap: () => navigateToDetail(snapshot.data[index]),
),
);
});
}
} ),
);
getDate(date){
this.date= date;
}
final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
void checkMethodSimple(int value) {
}
// @override
// void initState() {
// riskLevel();
// // TODO: implement initState
// super.initState();
// }
class DetailPage extends StatefulWidget {
final DocumentSnapshot riskLocation;
DetailPage({this.riskLocation});
@override
_DetailPageState createState() => _DetailPageState();
//---------------------------------------------Hotel Name-----------------------------------------------------
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: "Ex : Hilton",
labelText: 'Hotel Name'
),
// ignore: missing_return
validator: (String value){
if (value.isEmpty) {
return '*Hotel Name Required';
}
},
// onSaved: (String value){
// _fName = value;
// },
onChanged: (String hotelName){
getHotelName(hotelName);
},
);
}
//---------------------------------------------District-----------------------------------------------------
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: "Ex : Colombo",
labelText: 'District'
),
// ignore: missing_return
validator: (String value){
if (value.isEmpty) {
return '*District is Required';
}
},
// onSaved: (String value){
// _fName = value;
// },
onChanged: (String district){
getDistrict(district);
},
);
}
//---------------------------------------------Near To District-----------------------------------------------------
Widget _buildNearToDistrict(){
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: "Ex : 0 or 1",
labelText: 'Near to District or not'
),
// ignore: missing_return
validator: (String value){
if (value.isEmpty) {
return '*This is Required';
}
},
// onSaved: (String value){
// _fName = value;
// },
onChanged: (String nearToDistrict){
getNearDistrict(nearToDistrict);
},
);
}
//---------------------------------------------No of people-----------------------------------------------------
Widget _buildNoOfPeople(){
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.people_outline),
hintText: "Ex : 250",
labelText: 'No Of People'
),
// ignore: missing_return
validator: (String value){
if (value.isEmpty) {
return '*This is Required';
}
},
// onSaved: (String value){
// _fName = value;
// },
onChanged: (String noOfPeople){
getPeople(noOfPeople);
},
);
}
//---------------------------------------------Date-----------------------------------------------------
Widget _buildDate(){
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.calendar_today),
hintText: "Ex : 2021/04/03",
labelText: 'Date'
),
// ignore: missing_return
validator: (String value){
if (value.isEmpty) {
return '*Date is Required';
}
},
// onSaved: (String value){
// _fName = value;
// },
onChanged: (String date){
getNearDistrict(date);
},
);
}
class _DetailPageState extends State<DetailPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backwardsCompatibility: false,
backgroundColor: Color(0xFF1B5E20),
title: Text(widget.riskLocation.data()["hotelName"]),
title: Text("Search a Hotel"),
),
body: Container(
width: MediaQuery.of(context).size.width,
height: 100,
child: Card(
elevation: 8,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20.0),
),
color: Colors.lightGreen[50],
child: ListTile(
leading: Icon(Icons.timelapse, size: 40),
title: Text("Date : ${widget.riskLocation.data()["date"]}" ,style: TextStyle(fontSize: 20.0,fontWeight: FontWeight.bold),),
subtitle: Text("Time : ${widget.riskLocation.data()["time"]}",style: TextStyle(fontSize: 20.0,fontWeight: FontWeight.bold),),
),
),
margin: EdgeInsets.all(24),
child: Form(
key: _formKey,
child: ListView(
scrollDirection: Axis.vertical,
//mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
SizedBox(height: 10),
_buildHotelName(),
SizedBox(height: 10),
_buildDistrict(),
SizedBox(height: 10),
_buildNearToDistrict(),
SizedBox(height: 10),
_buildNoOfPeople(),
SizedBox(height: 10),
_buildDate(),
SizedBox(height: 50),
//Image(image: AssetImage('lib/assets/images/200.gif')),
Image.asset('lib/assets/images/200.gif',fit: BoxFit.contain,width: 150,height: 150,),
Text('This is a Risk Location',style: TextStyle(fontSize: 20, color: Colors.red[900]),),
RaisedButton(
color: Colors.green,
child: Center(
child: Text(
'Check Risk Level',
style: TextStyle(color: Colors.white, fontSize: 20),
),
),
onPressed: () {
if(!_formKey.currentState.validate()) {
return;
}
// riskLevel();
} ,
),
],
),),
),
);
}
}
}
\ No newline at end of file
......@@ -33,7 +33,7 @@ dependencies:
wakelock: ^0.1.4+1
charts_flutter: ^0.9.0
flutter_spinkit: "^4.1.2"
google_maps_flutter: ^2.0.6
......@@ -52,6 +52,7 @@ dependencies:
git:
url: http://github.com/indikaNK/plugins.git
path: packages/camera/camera
google_maps_flutter: ^2.0.6
dev_dependencies:
......@@ -85,6 +86,7 @@ flutter:
- lib/assets/images/feedback80.png
- lib/assets/images/list80.png
- lib/assets/images/search80.png
- lib/assets/images/200.gif
- lib/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