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
4bd0762c
Commit
4bd0762c
authored
Aug 01, 2021
by
GayaniPKarunaratne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change normal methods to state method
parent
f472cba6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
87 additions
and
41 deletions
+87
-41
lib/EAnalyzer/SearchEvent.dart
lib/EAnalyzer/SearchEvent.dart
+87
-41
No files found.
lib/EAnalyzer/SearchEvent.dart
View file @
4bd0762c
...
@@ -83,7 +83,7 @@ class _SearchEventState extends State<SearchEvent> {
...
@@ -83,7 +83,7 @@ class _SearchEventState extends State<SearchEvent> {
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:
2
));
var
yesterday
=
now
.
subtract
(
const
Duration
(
days:
3
));
// String year = yesterday.year.toString();
// String year = yesterday.year.toString();
// String month = yesterday.month.toString();
// String month = yesterday.month.toString();
// String date = yesterday.day.toString();
// String date = yesterday.day.toString();
...
@@ -118,12 +118,12 @@ Map<String, dynamic> data = querySnapshot.data();
...
@@ -118,12 +118,12 @@ Map<String, dynamic> data = querySnapshot.data();
void
checkMethodSimple
(
int
value
)
{
void
checkMethodSimple
(
int
value
)
{
}
}
//
@override
@override
//
void initState() {
void
initState
()
{
// riskLevel();
//
// TODO: implement initState
// TODO: implement initState
//
super.initState();
super
.
initState
();
//
}
}
...
@@ -215,7 +215,7 @@ Widget _buildNoOfInfected(){
...
@@ -215,7 +215,7 @@ Widget _buildNoOfInfected(){
),
),
prefixIcon:
Icon
(
Icons
.
people_outlined
),
prefixIcon:
Icon
(
Icons
.
people_outlined
),
hintText:
"No Of Infected people"
,
hintText:
"No Of Infected people"
,
labelText:
noOfInfected
labelText:
this
.
noOfInfected
),
),
// ignore: missing_return
// ignore: missing_return
validator:
(
String
value
){
validator:
(
String
value
){
...
@@ -228,13 +228,13 @@ Widget _buildNoOfInfected(){
...
@@ -228,13 +228,13 @@ Widget _buildNoOfInfected(){
// },
// },
onChanged:
(
String
noOfInfected
){
onChanged:
(
String
noOfInfected
){
getInfected
(
noOfInfected
);
getInfected
(
noOfInfected
);
setState
(()
{
});
// DocumentReference documentReference = Firestore.instance.collection('RiskLevel').document('district');
// DocumentReference documentReference = Firestore.instance.collection('RiskLevel').document('district');
// print(documentReference);
// print(documentReference);
},
},
// Firestore.instance.collection('COLLECTION').document('ID').get().then((DocumentSnapshot) =>
// print(DocumentSnapshot.data['key'].toString());
// );
);
);
}
}
...
@@ -314,33 +314,37 @@ Future Getdata(url) async{
...
@@ -314,33 +314,37 @@ Future Getdata(url) async{
}
}
Future
<
void
>
check
()
async
{
Future
<
void
>
check
()
async
{
String
urls
=
'https://eanalyzer.herokuapp.com/api/eanalyzer?NoInfected='
+
noOfInfected
.
toString
()+
'&NearToDistrict='
+
nearToDistrict
.
toString
()+
'&NoOfPeople='
+
noOfPeople
.
toString
();
var
Data
=
await
Getdata
(
urls
);
setState
(()
async
{
var
reText
=
jsonDecode
(
Data
);
String
urls
=
'https://eanalyzer.herokuapp.com/api/eanalyzer?NoInfected='
+
noOfInfected
.
toString
()+
'&NearToDistrict='
+
nearToDistrict
.
toString
()+
'&NoOfPeople='
+
noOfPeople
.
toString
();
//print(reText);
var
Data
=
await
Getdata
(
urls
);
// var ex = [2];
var
reText
=
jsonDecode
(
Data
);
//-----------------------------------------------------OutPut------------------------------------------------------------------------------
//print(reText);
if
(
reText
.
toString
()
==
'[0]'
)
{
// var ex = [2];
//print("This is a Low Risk area");
//-----------------------------------------------------OutPut------------------------------------------------------------------------------
reText
=
"Low Risk"
;
if
(
reText
.
toString
()
==
'[0]'
)
{
finalRisk
=
reText
;
//print("This is a Low Risk area");
ima
=
101
;
reText
=
"Low Risk"
;
}
finalRisk
=
reText
;
else
if
(
reText
.
toString
()
==
'[1]'
)
{
ima
=
101
;
//print("This is a Moderate Risk area");
}
reText
=
"Moderate Risk"
;
else
if
(
reText
.
toString
()
==
'[1]'
)
{
finalRisk
=
reText
;
//print("This is a Moderate Risk area");
ima
=
102
;
reText
=
"Moderate Risk"
;
}
finalRisk
=
reText
;
else
if
(
reText
.
toString
()
==
'[2]'
)
{
ima
=
102
;
//print("This is a High Risk area");
}
reText
=
"High Risk"
;
else
if
(
reText
.
toString
()
==
'[2]'
)
{
finalRisk
=
reText
;
//print("This is a High Risk area");
ima
=
103
;
reText
=
"High Risk"
;
}
finalRisk
=
reText
;
print
(
reText
);
ima
=
103
;
tcVisibility
=
true
;
}
print
(
'
$now
'
);
print
(
reText
);
tcVisibility
=
true
;
print
(
'
$now
'
);
});
//print(now.subtract(dur));
//print(now.subtract(dur));
}
}
...
@@ -367,6 +371,14 @@ Future<void> check() async{
...
@@ -367,6 +371,14 @@ Future<void> check() async{
SizedBox
(
height:
10
),
SizedBox
(
height:
10
),
_buildDistrict
(),
_buildDistrict
(),
SizedBox
(
height:
10
),
SizedBox
(
height:
10
),
new
RaisedButton
(
shape:
RoundedRectangleBorder
(
borderRadius:
BorderRadius
.
circular
(
18.0
),
side:
BorderSide
(
color:
Colors
.
green
)),
child:
new
Text
(
'View No of Infected People'
,
textAlign:
TextAlign
.
center
,
style:
TextStyle
(
color:
Colors
.
green
[
900
],
fontSize:
17
),),
onPressed:
voteUp
,
),
SizedBox
(
height:
10
),
_buildNoOfInfected
(),
_buildNoOfInfected
(),
SizedBox
(
height:
10
),
SizedBox
(
height:
10
),
_buildNearToDistrict
(),
_buildNearToDistrict
(),
...
@@ -382,7 +394,7 @@ Future<void> check() async{
...
@@ -382,7 +394,7 @@ Future<void> check() async{
// Text('This is a $finalRisk area',style: TextStyle(fontSize: 25,fontWeight: FontWeight.bold, color: Colors.red[900]),)),
// Text('This is a $finalRisk area',style: TextStyle(fontSize: 25,fontWeight: FontWeight.bold, color: Colors.red[900]),)),
// SizedBox(height: 10),
// SizedBox(height: 10),
Visibility
(
Visibility
(
visible:
tcVisibility
,
visible:
tcVisibility
,
...
@@ -415,8 +427,10 @@ Future<void> check() async{
...
@@ -415,8 +427,10 @@ Future<void> check() async{
style:
TextStyle
(
color:
Colors
.
white
,
fontSize:
30
),
style:
TextStyle
(
color:
Colors
.
white
,
fontSize:
30
),
),
),
onPressed:
()
{
onPressed:
()
{
check
();
check
();
Visibility
();
Visibility
();
voteUp
();
// if(!_formKey.currentState.validate()) {
// if(!_formKey.currentState.validate()) {
// return;
// return;
...
@@ -431,9 +445,41 @@ Future<void> check() async{
...
@@ -431,9 +445,41 @@ Future<void> check() async{
),
),
SizedBox
(
height:
20
),
RaisedButton
(
shape:
RoundedRectangleBorder
(
borderRadius:
BorderRadius
.
circular
(
18.0
),
side:
BorderSide
(
color:
Colors
.
blue
[
900
])),
padding:
EdgeInsets
.
all
(
15.0
),
color:
Colors
.
blue
[
900
],
child:
Text
(
'View Risk Level'
,
textAlign:
TextAlign
.
center
,
style:
TextStyle
(
color:
Colors
.
white
,
fontSize:
30
),
),
onPressed:
voteUp
,
),
// new Text('Up Votes: $votes'),
// new RaisedButton(
// shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(18.0),
// side: BorderSide(color: Colors.green[900])),
// child: new Text('Vote up'),
// onPressed: voteUp,
// ),
],
],
),),
),),
),
),
);
);
}
}
int
votes
=
0
;
void
voteUp
()
{
setState
(()
{
votes
=
votes
+
1
;
});
}
}
}
\ No newline at end of file
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