Commit ef3ee4b3 authored by GayaniPKarunaratne's avatar GayaniPKarunaratne

Save awairness level to firebase

parent a8dd8153
...@@ -4,6 +4,7 @@ import 'package:firebase_auth/firebase_auth.dart'; ...@@ -4,6 +4,7 @@ import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../main.dart'; import '../main.dart';
import '../STracker/variables.dart';
...@@ -54,6 +55,21 @@ class _RegisterState extends State<Register> { ...@@ -54,6 +55,21 @@ class _RegisterState extends State<Register> {
FirebaseUser user = result.user; FirebaseUser user = result.user;
print("******* Executing updateUserdata ********"); print("******* Executing updateUserdata ********");
if (marks6 == "Very Low") {
_awarenessLevel = "0";
}else if (marks6 == "Low") {
_awarenessLevel = "1";
}else if (marks6 == "Moderate") {
_awarenessLevel = "2";
}else if (marks6 == "High") {
_awarenessLevel = "3";
}else if (marks6 == "Very High") {
_awarenessLevel = "4";
}
await dataService(uid: user.uid).updateUserData( await dataService(uid: user.uid).updateUserData(
_email, _email,
_name, _name,
...@@ -217,11 +233,15 @@ class _RegisterState extends State<Register> { ...@@ -217,11 +233,15 @@ class _RegisterState extends State<Register> {
Container( Container(
child: TextFormField( child: TextFormField(
readOnly: true,
decoration: InputDecoration( decoration: InputDecoration(
labelText: 'Your Awareness Level', labelText: marks6,
prefixIcon: Icon(Icons.notifications_paused_outlined) prefixIcon: Icon(Icons.notifications_paused_outlined)
), ),
onSaved: (input) => _awarenessLevel = input, onSaved: (input) {
print("Awaireness Level"+marks6);
_awarenessLevel = input;
}
), ),
), ),
......
...@@ -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: 3)); var yesterday = now.subtract(const Duration(days: 2));
// 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();
......
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