Commit 885a0ba4 authored by indika N kumara's avatar indika N kumara

Merge branch 'EAnalyzer_KarunaratneGP' into 'develop_1'

E analyzer karunaratne gp

See merge request !26
parents 4aac3c3f c15ed477
...@@ -109,10 +109,23 @@ class AddLocationState extends State<AddLocation> { ...@@ -109,10 +109,23 @@ class AddLocationState extends State<AddLocation> {
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(
validator: (String value) { 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.face),
hintText: "Ex : John Smith",
labelText: 'Full Name'
),
// ignore: missing_return
validator: (String value){
if (value.isEmpty) { if (value.isEmpty) {
return '*Full Name is Required'; return '*Full Name is Required';
} }
...@@ -120,19 +133,31 @@ class AddLocationState extends State<AddLocation> { ...@@ -120,19 +133,31 @@ class AddLocationState extends State<AddLocation> {
// 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(
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.phone),
hintText: "Ex : 011XXXXXXX",
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';
} }
...@@ -140,17 +165,29 @@ class AddLocationState extends State<AddLocation> { ...@@ -140,17 +165,29 @@ class AddLocationState extends State<AddLocation> {
// 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(
validator: (String value) { 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 : Galle",
labelText: 'Risk Location'
),
validator: (String value){
if (value.isEmpty) { if (value.isEmpty) {
return '*Risk Location is Required'; return '*Risk Location is Required';
} }
...@@ -158,17 +195,29 @@ class AddLocationState extends State<AddLocation> { ...@@ -158,17 +195,29 @@ class AddLocationState extends State<AddLocation> {
// 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(
validator: (String value) { 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.hotel),
hintText: "Ex : Hilton",
labelText: 'Hotel Name'
),
validator: (String value){
if (value.isEmpty) { if (value.isEmpty) {
return '*Hotel Name is Required'; return '*Hotel Name is Required';
} }
...@@ -176,17 +225,29 @@ class AddLocationState extends State<AddLocation> { ...@@ -176,17 +225,29 @@ class AddLocationState extends State<AddLocation> {
// 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(
validator: (String value) { 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'
),
validator: (String value){
if (value.isEmpty) { if (value.isEmpty) {
return '*Date is Required'; return '*Date is Required';
} }
...@@ -194,17 +255,30 @@ class AddLocationState extends State<AddLocation> { ...@@ -194,17 +255,30 @@ class AddLocationState extends State<AddLocation> {
// 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(
validator: (String value) { 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.lock_clock),
hintText: "Ex : 2.00 P.M",
labelText: 'Time'
),
// ignore: missing_return
validator: (String value){
if (value.isEmpty) { if (value.isEmpty) {
return '*Time is Required'; return '*Time is Required';
} }
...@@ -212,11 +286,12 @@ class AddLocationState extends State<AddLocation> { ...@@ -212,11 +286,12 @@ class AddLocationState extends State<AddLocation> {
// 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) {
...@@ -234,14 +309,21 @@ class AddLocationState extends State<AddLocation> { ...@@ -234,14 +309,21 @@ class AddLocationState extends State<AddLocation> {
scrollDirection: Axis.vertical, scrollDirection: Axis.vertical,
//mainAxisAlignment: MainAxisAlignment.center, //mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[ children: <Widget>[
SizedBox(height: 10),
_buildName(), _buildName(),
SizedBox(height: 10),
_buildPNo(), _buildPNo(),
SizedBox(height: 10),
_buildLocation(), _buildLocation(),
SizedBox(height: 10),
_buildHotelName(), _buildHotelName(),
SizedBox(height: 10),
_buildDate(), _buildDate(),
SizedBox(height: 10),
_buildTime(), _buildTime(),
SizedBox(height: 100), //---------------------------------------------Submit-----------------------------------------------------
SizedBox(height: 50),
RaisedButton( RaisedButton(
color: Colors.green, color: Colors.green,
child: Text( child: Text(
...@@ -249,12 +331,14 @@ class AddLocationState extends State<AddLocation> { ...@@ -249,12 +331,14 @@ class AddLocationState extends State<AddLocation> {
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(
...@@ -269,7 +353,7 @@ class AddLocationState extends State<AddLocation> { ...@@ -269,7 +353,7 @@ class AddLocationState extends State<AddLocation> {
// } , // } ,
// ), // ),
//---------------------------------------------Update-----------------------------------------------------
RaisedButton( RaisedButton(
color: Colors.yellowAccent[700], color: Colors.yellowAccent[700],
child: Text( child: Text(
...@@ -277,10 +361,12 @@ class AddLocationState extends State<AddLocation> { ...@@ -277,10 +361,12 @@ class AddLocationState extends State<AddLocation> {
style: TextStyle(color: Colors.white, fontSize: 18), style: TextStyle(color: Colors.white, fontSize: 18),
), ),
onPressed: () { onPressed: () {
updateData(); updateData();
},
),
} ,
),
//---------------------------------------------Delete-----------------------------------------------------
RaisedButton( RaisedButton(
color: Colors.red, color: Colors.red,
child: Text( child: Text(
...@@ -288,12 +374,17 @@ class AddLocationState extends State<AddLocation> { ...@@ -288,12 +374,17 @@ class AddLocationState extends State<AddLocation> {
style: TextStyle(color: Colors.white, fontSize: 18), style: TextStyle(color: Colors.white, fontSize: 18),
), ),
onPressed: () { onPressed: () {
deleteData(); deleteData();
},
} ,
), ),
], ],
), ),),
),
), ),
); );
} }
......
import 'package:covidefender/EAnalyzer/HospitalDetails.dart'; import 'package:covidefender/EAnalyzer/HospitalDetails.dart';
import 'package:covidefender/EAnalyzer/HotelMap.dart';
import 'package:covidefender/EAnalyzer/SearchEvent.dart'; import 'package:covidefender/EAnalyzer/SearchEvent.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'AddLocation.dart'; import 'AddLocation.dart';
import 'RiskEventList.dart';
class EAnalyzerDash extends StatelessWidget { class EAnalyzerDash extends StatelessWidget {
@override @override
...@@ -56,6 +58,7 @@ class EAnalyzerDash extends StatelessWidget { ...@@ -56,6 +58,7 @@ class EAnalyzerDash extends StatelessWidget {
primary: false, primary: false,
crossAxisCount: 2, crossAxisCount: 2,
children: <Widget>[ children: <Widget>[
//--------------------------------------Cards--------------------------------------------------------------------------------------
Card( Card(
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8)), borderRadius: BorderRadius.circular(8)),
...@@ -107,7 +110,7 @@ class EAnalyzerDash extends StatelessWidget { ...@@ -107,7 +110,7 @@ class EAnalyzerDash extends StatelessWidget {
onPressed: () { onPressed: () {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute(builder: (context) => EAnalyzerDash()), MaterialPageRoute(builder: (context) => RiskEventList()),
); );
}, },
child: Image.asset('lib/assets/images/list80.png'), child: Image.asset('lib/assets/images/list80.png'),
...@@ -156,6 +159,26 @@ class EAnalyzerDash extends StatelessWidget { ...@@ -156,6 +159,26 @@ class EAnalyzerDash extends StatelessWidget {
], ],
) )
), ),
Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8)),
elevation: 4,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
FlatButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => HotelMap()),
);
},
child: Image.asset('lib/assets/images/feedback80.png'),
),
Text('Hotel Map', style: TextStyle(fontSize: 20.0))
],
)
),
], ],
), ),
) )
......
...@@ -72,6 +72,9 @@ class _HospitalDetailsState extends State<HospitalDetails> { ...@@ -72,6 +72,9 @@ class _HospitalDetailsState extends State<HospitalDetails> {
padding: const EdgeInsets.all(12.0), padding: const EdgeInsets.all(12.0),
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
// CircleAvatar(
// ),
Padding( Padding(
padding: const EdgeInsets.all(12.0), 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"]}", 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"]}",
......
import 'package:flutter/material.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
class HotelMap extends StatefulWidget {
@override
_HotelMapState createState() => _HotelMapState();
}
class _HotelMapState extends State<HotelMap> {
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: AppBar(
backwardsCompatibility: false,
backgroundColor: Color(0xFF1B5E20),
title: Text("Hotel Google Map"),
),
body: Center(
child: Container(
height: MediaQuery.of(context).size.height,
width: MediaQuery.of(context).size.width,
child: GoogleMap(
initialCameraPosition: CameraPosition(
target: LatLng(7.8731, 80.7718),
zoom: 8.0,
),
),
),
),
);
}
}
\ No newline at end of file
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),),
),
),
),
);
}
}
This diff is collapsed.
...@@ -27,7 +27,7 @@ class _HomeScreenState extends State<HomeScreen> { ...@@ -27,7 +27,7 @@ class _HomeScreenState extends State<HomeScreen> {
body: Stack( body: Stack(
children: <Widget>[ children: <Widget>[
Container( Container(
height: size.height * .2, //height: size.height * .2,
decoration: BoxDecoration( decoration: BoxDecoration(
image: DecorationImage( image: DecorationImage(
alignment: Alignment.topCenter, alignment: Alignment.topCenter,
...@@ -44,11 +44,11 @@ class _HomeScreenState extends State<HomeScreen> { ...@@ -44,11 +44,11 @@ class _HomeScreenState extends State<HomeScreen> {
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
// CircleAvatar( CircleAvatar(
// radius: 32, radius: 55,
// backgroundImage: NetworkImage( backgroundColor: Colors.transparent,
// 'https://upload.wikimedia.org/wikipedia/commons/a/a0/Pierre-Person.jpg'), backgroundImage: AssetImage('lib/assets/images/cdlogo2.png'),
// ), ),
SizedBox( SizedBox(
width: 16, width: 16,
), ),
......
...@@ -91,6 +91,12 @@ flutter: ...@@ -91,6 +91,12 @@ flutter:
- lib/assets/images/feedback80.png - lib/assets/images/feedback80.png
- lib/assets/images/list80.png - lib/assets/images/list80.png
- lib/assets/images/search80.png - lib/assets/images/search80.png
- lib/assets/images/101.gif
- lib/assets/images/102.gif
- lib/assets/images/103.gif
- lib/assets/images/cdlogo.png
- lib/assets/images/cdlogo1.png
- lib/assets/images/cdlogo2.png
- lib/assets/ - 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