Commit 0cbc0d9c authored by Indika NK's avatar Indika NK

Added Basic logic to selfcare part

parent 3ffd8308
import 'package:covidefender/pages/heart_rate/heart_rate_screen.dart';
import 'package:covidefender/pages/mask_detect/invoker.dart';
import 'package:covidefender/pages/self_carer/sc_main_screen.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
......@@ -136,7 +137,9 @@ class I_guider extends StatelessWidget {
'',
style: TextStyle(fontWeight: FontWeight.bold),
),
onPressed: () {},
onPressed: () {
Navigator.push(context, MaterialPageRoute(builder: (context)=> SC_main()));
},
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10)),
),
......
import 'package:covidefender/pages/self_carer/Custom_Switch.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class SC_resultScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Results'),
),
body: Center(
child: Column(
children: [
Center(
child: Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height / 2.5,
child: Image.asset('lib/assets/images/hero.gif')),
),
Text("Analysis Results"),
ElevatedButton(onPressed: (){}, child: Text('Medical Support'))
],
),
),
);
}
}
class Symptoms {
String symptomname;
bool value;
Symptoms(this.symptomname, this.value);
@override
String toString() {
return 'Symptoms{symptomname: $symptomname, value: $value}';
}
}
\ No newline at end of file
import 'dart:collection';
import 'package:covidefender/pages/self_carer/Custom_Switch.dart';
import 'package:covidefender/pages/self_carer/SC_result_screen.dart';
import 'package:flutter/material.dart';
import 'package:quiver/collection.dart';
import 'model/Symptoms.dart';
class SC_main extends StatefulWidget {
@override
SC_mainState createState() => SC_mainState();
}
class SC_mainState extends State<SC_main> {
bool isPositiveMatch = false;
// String symptom = "i am a symptom";
// HashMap symptomMap = new HashMap<int,String>();
Map<String, bool> symptomList = HashMap();
Map<String, bool> values = {
'Fever With Chills': false,
'Cough and Sneezing': false,
'Difficulty in Breathing': false,
'Sore throat / Blush lips': false,
'Mustle Pain or Ache': false,
};
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Self-Carer"),
),
body: Container(
child: SingleChildScrollView(
child: Column(
children: [
Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height / 2.5,
child: Image.asset('lib/assets/images/hero.gif')),
SizedBox(
height: 300,
child: new ListView(
children: values.keys.map((String key) {
return new CheckboxListTile(
title: new Text(key),
value: values[key],
onChanged: (bool value) {
setState(() {
values[key] = value;
symptomList.clear();
values.forEach((key, value) {
print('${key}: ${value}');
if (value) {
symptomList.putIfAbsent(key, () => value);
// if(symptomList.containsKey('Food') && symptomList.containsKey('Materials') ){
// print("all is here");
// }else if(symptomList.containsKey('Food')){
// print("Food only is here");
// Navigator.push(context, MaterialPageRoute(builder: (context)=>HomeScreen()));
// Navigator.pop(context);
// }
print(
'Selected Items::' + symptomList.toString());
}
});
});
print(key);
},
);
}).toList(),
),
)
// Padding(
// padding: const EdgeInsets.all(8.0),
// child: Card(
// elevation: 8,
// shape: RoundedRectangleBorder(
// borderRadius: BorderRadius.circular(15)),
// color: Colors.lightBlueAccent[100],
// child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// Container(
// child: Image(
// image:
// AssetImage('lib/assets/images/man80.png'))),
// // SizedBox(width: 50),
// Text("Fever With Chills",style: TextStyle(color: Colors.white)),
// // SizedBox(width: 70),
// Checkbox(value: cbTestvalue, onChanged: (bool value){
// setState(() {
//
// });
// })
//
//
//
],
),
),
),
floatingActionButton: FloatingActionButton(
onPressed: () => {
if (symptomList.isEmpty)
{print("Please select your Symptoms")}
else
{
if(symptomList.containsKey('Fever With Chills')
&& symptomList.containsKey('Cough and Sneezing')
&& symptomList.containsKey('Difficulty in Breathing')
&& symptomList.containsKey('Sore throat / Blush lips')
&& symptomList.containsKey('Mustle Pain or Ache')){
print("Positive Match Found Immediate Treatements needed !"),
Navigator.push(context,
MaterialPageRoute(builder: (context) => SC_resultScreen()))
}
}
},
child: Icon(
// Icons.next_plan_outlined
Icons.double_arrow_rounded)),
);
}
}
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