Commit e3e5cab2 authored by GayaniPKarunaratne's avatar GayaniPKarunaratne

Merge branch 'EAnalyzer_KarunaratneGP' of http://gitlab.sliit.lk/2021-035/2021-035-covidefender

parents 3f39a305 ac02a9e1
...@@ -259,18 +259,18 @@ Widget _buildTime(){ ...@@ -259,18 +259,18 @@ Widget _buildTime(){
} , } ,
), ),
RaisedButton( // RaisedButton(
color: Colors.blue, // color: Colors.blue,
child: Text( // child: Text(
'View', // 'View',
style: TextStyle(color: Colors.white, fontSize: 18), // style: TextStyle(color: Colors.white, fontSize: 18),
), // ),
onPressed: () { // onPressed: () {
readData(); // readData();
} , // } ,
), // ),
RaisedButton( RaisedButton(
color: Colors.yellowAccent[700], color: Colors.yellowAccent[700],
......
import 'package:covidefender/EAnalyzer/HospitalDetails.dart'; import 'package:covidefender/EAnalyzer/HospitalDetails.dart';
import 'package:covidefender/EAnalyzer/SearchEvent.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'AddLocation.dart'; import 'AddLocation.dart';
...@@ -126,7 +127,7 @@ class EAnalyzerDash extends StatelessWidget { ...@@ -126,7 +127,7 @@ class EAnalyzerDash extends StatelessWidget {
onPressed: () { onPressed: () {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute(builder: (context) => EAnalyzerDash()), MaterialPageRoute(builder: (context) => SearchEvent()),
); );
}, },
child: Image.asset('lib/assets/images/search80.png'), child: Image.asset('lib/assets/images/search80.png'),
......
...@@ -63,13 +63,15 @@ class _HospitalDetailsState extends State<HospitalDetails> { ...@@ -63,13 +63,15 @@ class _HospitalDetailsState extends State<HospitalDetails> {
itemCount: userData == null ? 0 : userData.length, itemCount: userData == null ? 0 : userData.length,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
return Card( return Card(
elevation: 8,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20.0),
),
color: Colors.lightGreen[50],
child: Padding( child: Padding(
padding: const EdgeInsets.all(12.0), padding: const EdgeInsets.all(12.0),
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
CircleAvatar(
//backgroundImage: NetworkImage(userData[index]["hospital_id"]) ,
),
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"]}",
......
...@@ -21,13 +21,13 @@ class _LoadingScreenState extends State<LoadingScreen> { ...@@ -21,13 +21,13 @@ class _LoadingScreenState extends State<LoadingScreen> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
backgroundColor: Colors.green.shade300, backgroundColor: Colors.lightGreen[400],
body: Stack( body: Stack(
children: <Widget>[ children: <Widget>[
Container( Container(
decoration: BoxDecoration( decoration: BoxDecoration(
image: DecorationImage( image: DecorationImage(
alignment: Alignment.topCenter, alignment: Alignment.center,
image: AssetImage('lib/assets/images/eana.png'), image: AssetImage('lib/assets/images/eana.png'),
))), ))),
] ]
......
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 an Event"),
),
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: 410,
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),),
),
),
),
);
}
}
...@@ -141,6 +141,13 @@ packages: ...@@ -141,6 +141,13 @@ packages:
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
flutter_spinkit:
dependency: "direct main"
description:
name: flutter_spinkit
url: "https://pub.dartlang.org"
source: hosted
version: "4.1.2+1"
flutter_svg: flutter_svg:
dependency: "direct main" dependency: "direct main"
description: description:
......
...@@ -32,6 +32,7 @@ dependencies: ...@@ -32,6 +32,7 @@ dependencies:
quiver: ^2.0.0 quiver: ^2.0.0
wakelock: ^0.1.4+1 wakelock: ^0.1.4+1
charts_flutter: ^0.9.0 charts_flutter: ^0.9.0
flutter_spinkit: "^4.1.2"
......
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