Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2021-035-CoviDefender
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
2021-035
2021-035-CoviDefender
Commits
c4281225
Commit
c4281225
authored
Jul 31, 2021
by
GayaniPKarunaratne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Get no of infected people due to current date
parent
c4d536dc
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
3 deletions
+48
-3
lib/EAnalyzer/SearchEvent.dart
lib/EAnalyzer/SearchEvent.dart
+48
-3
No files found.
lib/EAnalyzer/SearchEvent.dart
View file @
c4281225
// import 'dart:convert';
// import 'dart:convert';
// import 'dart:html';
// import 'dart:html';
import
'package:cloud_firestore/cloud_firestore.dart'
;
import
'package:intl/date_symbol_data_local.dart'
;
import
'package:intl/date_symbol_data_local.dart'
;
import
'dart:convert'
;
import
'dart:convert'
;
import
'dart:ffi'
;
import
'dart:ffi'
;
...
@@ -9,6 +10,7 @@ import 'package:flutter/material.dart';
...
@@ -9,6 +10,7 @@ import 'package:flutter/material.dart';
// import 'package:cloud_firestore/cloud_firestore.dart';
// import 'package:cloud_firestore/cloud_firestore.dart';
import
'package:http/http.dart'
as
http
;
import
'package:http/http.dart'
as
http
;
import
'package:quiver/testing/time.dart'
;
import
'package:quiver/testing/time.dart'
;
import
'package:intl/intl.dart'
;
class
SearchEvent
extends
StatefulWidget
{
class
SearchEvent
extends
StatefulWidget
{
...
@@ -26,6 +28,8 @@ class _SearchEventState extends State<SearchEvent> {
...
@@ -26,6 +28,8 @@ class _SearchEventState extends State<SearchEvent> {
String
noOfPeople
;
String
noOfPeople
;
int
ima
;
int
ima
;
//final List<String> dist = ['ampara', 'anuradhapura', 'badulla', 'batticaloa','colombo','galle','gampaha','hambantota','jaffna','kalmunai','kalutara','kandy','kegalle','kilinochchi','kurunagala','mannar','matale','matara','monaragala','mullaitivu','nuwara eliya','polonnaruwa','puttalam','ratnapura','trincomalee','vavuniya'];
//final List<String> dist = ['ampara', 'anuradhapura', 'badulla', 'batticaloa','colombo','galle','gampaha','hambantota','jaffna','kalmunai','kalutara','kandy','kegalle','kilinochchi','kurunagala','mannar','matale','matara','monaragala','mullaitivu','nuwara eliya','polonnaruwa','puttalam','ratnapura','trincomalee','vavuniya'];
var
finalRisk
=
'rrrr'
;
var
finalRisk
=
'rrrr'
;
...
@@ -33,9 +37,9 @@ class _SearchEventState extends State<SearchEvent> {
...
@@ -33,9 +37,9 @@ class _SearchEventState extends State<SearchEvent> {
var
tcVisibility
=
false
;
var
tcVisibility
=
false
;
DateTime
now
=
new
DateTime
.
now
();
DateTime
now
=
new
DateTime
.
now
();
Duration
dur
=
new
Duration
(
days:
1
);
//
Duration dur = new Duration(days: 1);
//var yesterday = now.subtract(const Duration(days: 1));
//
var yesterday = now.subtract(const Duration(days: 1));
// var formatterDate = new DateFormat('dd');
// var formatterDate = new DateFormat('dd');
// var formatterMonth = new DateFormat('MM');
// var formatterMonth = new DateFormat('MM');
// var formatterYear = new DateFormat('yyyy');
// var formatterYear = new DateFormat('yyyy');
...
@@ -75,6 +79,39 @@ class _SearchEventState extends State<SearchEvent> {
...
@@ -75,6 +79,39 @@ class _SearchEventState extends State<SearchEvent> {
this
.
noOfPeople
=
noOfPeople
;
this
.
noOfPeople
=
noOfPeople
;
}
}
getNumberOfcases
(
String
district
)
async
{
DateTime
now
=
new
DateTime
.
now
();
//Duration dur = new Duration(days: 1);
var
yesterday
=
now
.
subtract
(
const
Duration
(
days:
1
));
// String year = yesterday.year.toString();
// String month = yesterday.month.toString();
// String date = yesterday.day.toString();
String
formattedDate
=
new
DateFormat
(
'yyyy-MM-dd'
).
format
(
yesterday
);
// // String riskLevelDocument = location + '_' + formattedDate;
// // var formatterDate = new DateFormat('dd');
// // var formatterMonth = new DateFormat('MM');
// // var formatterYear = new DateFormat('yyyy');
// // String date = formatterDate.format(yesterday);
// // String month = formatterMonth.format(yesterday);
// String year = formatterYear.format(yesterday);
String
riskLevelDocument
=
district
+
'_'
+
formattedDate
;
// var a = Firestore.instance.collection('RiskLevel').document(riskLevelDocument)
// .get().then(function(Document) =>
// print(Document("cases"));
// );
DocumentSnapshot
querySnapshot
=
await
Firestore
.
instance
.
collection
(
"RiskLevel"
).
document
(
riskLevelDocument
).
get
();
Map
<
String
,
dynamic
>
data
=
querySnapshot
.
data
();
// val = querySnapshot.documents.length;
// var val = data['cases'];
// String riskLevelDocument = location + finalDate;
this
.
noOfInfected
=
data
[
'cases'
];
print
(
noOfInfected
);
// return data['cases'].toString();
}
final
GlobalKey
<
FormState
>
_formKey
=
GlobalKey
<
FormState
>();
final
GlobalKey
<
FormState
>
_formKey
=
GlobalKey
<
FormState
>();
...
@@ -157,6 +194,7 @@ Widget _buildDistrict(){
...
@@ -157,6 +194,7 @@ Widget _buildDistrict(){
},
},
onChanged:
(
String
district
){
onChanged:
(
String
district
){
getDistrict
(
district
);
getDistrict
(
district
);
getNumberOfcases
(
district
);
},
},
);
);
}
}
...
@@ -189,7 +227,14 @@ Widget _buildNoOfInfected(){
...
@@ -189,7 +227,14 @@ Widget _buildNoOfInfected(){
// },
// },
onChanged:
(
String
noOfInfected
){
onChanged:
(
String
noOfInfected
){
getInfected
(
noOfInfected
);
getInfected
(
noOfInfected
);
// DocumentReference documentReference = Firestore.instance.collection('RiskLevel').document('district');
// print(documentReference);
},
},
// Firestore.instance.collection('COLLECTION').document('ID').get().then((DocumentSnapshot) =>
// print(DocumentSnapshot.data['key'].toString());
// );
);
);
}
}
...
@@ -295,7 +340,7 @@ Future<void> check() async{
...
@@ -295,7 +340,7 @@ Future<void> check() async{
print
(
reText
);
print
(
reText
);
tcVisibility
=
true
;
tcVisibility
=
true
;
print
(
'
$now
'
);
print
(
'
$now
'
);
print
(
now
.
subtract
(
dur
));
//
print(now.subtract(dur));
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment