fixade feedback #33
File diff suppressed because one or more lines are too long
|
@ -12,8 +12,6 @@ Color _colorContainerHappy = _backgroundColor;
|
||||||
Color _colorContainerMediumHappy = _backgroundColor;
|
Color _colorContainerMediumHappy = _backgroundColor;
|
||||||
Color _colorContainerUpset = _backgroundColor;
|
Color _colorContainerUpset = _backgroundColor;
|
||||||
|
|
||||||
var timestamp;
|
|
||||||
|
|
||||||
|
|
||||||
Map<String, bool> _satisfactionBoolean = {
|
Map<String, bool> _satisfactionBoolean = {
|
||||||
"VeryHappy": false,
|
"VeryHappy": false,
|
||||||
|
@ -54,14 +52,13 @@ class FormForFeedbackState extends State<FormForFeedback> {
|
||||||
var dataBase = mysql();
|
var dataBase = mysql();
|
||||||
|
|
||||||
|
|
||||||
Future<void> feedbackVerification(String satisfaction, String typeOfFeedback, String writtenFeedback, String timestamp ) async {
|
Future<void> feedbackVerification(String satisfaction, String typeOfFeedback, String writtenFeedback) async {
|
||||||
await dataBase.getConnection().then((conn) async {
|
await dataBase.getConnection().then((conn) async {
|
||||||
String sql = "INSERT INTO maen0574.User_feedback (id, Satisfaction, Type_of_feedback, Written_feedback, timestamp) VALUES (null, '$satisfaction', '$typeOfFeedback', '$writtenFeedback', '$timestamp);";
|
String sql = "INSERT INTO maen0574.User_feedback (Satisfaction, Type_of_feedback, Written_feedback) VALUES ('$satisfaction', '$typeOfFeedback', '$writtenFeedback');";
|
||||||
await conn.query(sql).then((results) {
|
await conn.query(sql).then((results) {
|
||||||
for(var row in results) {
|
for(var row in results) {
|
||||||
print(row[0].toString());
|
|
||||||
setState(() {});
|
setState(() {});
|
||||||
form(row[0].toString(), row[1].toString(), row[2].toString(), row[3]);
|
form(row[0].toString(), row[1].toString(), row[2].toString(), row[3].toString());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -339,31 +336,48 @@ class FormForFeedbackState extends State<FormForFeedback> {
|
||||||
InkWell(
|
InkWell(
|
||||||
|
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
|
print(writtenFeedback.text);
|
||||||
if(writtenFeedback.text.contains("'")) {
|
if (writtenFeedback.text.contains("'")) {
|
||||||
print('not allowed to use atrophies');
|
print('not allowed to use atrophies');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
timestamp = DateTime.now().millisecondsSinceEpoch.toString();
|
await feedbackVerification(satisfaction.text, typeOfFeedback.text, writtenFeedback.text);
|
||||||
await feedbackVerification(satisfaction.text, typeOfFeedback.text, writtenFeedback.text, timestamp);
|
print(satisfaction.text);
|
||||||
if (_formKey.currentState!.validate()) {
|
print(typeOfFeedback.text);
|
||||||
|
print(writtenFeedback.text);
|
||||||
|
|
||||||
print(satisfaction.text);
|
//pop-up thank you for answering
|
||||||
print(typeOfFeedback.text);
|
|
||||||
print(writtenFeedback.text);
|
|
||||||
print(timestamp);
|
|
||||||
|
|
||||||
Navigator.push(
|
showDialog<String>(
|
||||||
context,
|
context: context,
|
||||||
MaterialPageRoute(builder: (context) =>
|
builder: (BuildContext context) =>
|
||||||
BottomNavPage()), //Replace Container() with call to account-page.
|
AlertDialog(
|
||||||
);
|
title: const Text('Thank you'),
|
||||||
}
|
content: const Text('Thank you for your feedback, '
|
||||||
|
'you will now be sent back to the map'),
|
||||||
|
actions: <Widget>[
|
||||||
|
TextButton(
|
||||||
|
child: const Text('Ok'),
|
||||||
|
onPressed: () =>
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(builder: (context) =>
|
||||||
|
BottomNavPage()),
|
||||||
|
//Replace Container() with call to account-page.
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
pressedEmojiColor("clear");
|
||||||
|
pressedTypeOfFeedback("clear");
|
||||||
|
writtenFeedback.text = '';
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
child: Container(
|
child: Container(
|
||||||
color: _colorContainerHappy,
|
color: Colors.purple,
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: const <Widget>[
|
children: const <Widget>[
|
||||||
|
@ -381,15 +395,11 @@ class FormForFeedbackState extends State<FormForFeedback> {
|
||||||
|
|
||||||
const SizedBox(height: 30),
|
const SizedBox(height: 30),
|
||||||
|
|
||||||
],
|
],
|
||||||
),
|
|
||||||
|
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -441,6 +451,17 @@ void pressedEmojiColor (String s) {
|
||||||
_satisfactionBoolean["Upset"] == false;
|
_satisfactionBoolean["Upset"] == false;
|
||||||
_colorContainerUpset = _backgroundColor;
|
_colorContainerUpset = _backgroundColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(s == "clear"){
|
||||||
|
_satisfactionBoolean["VeryHappy"] = false;
|
||||||
|
_colorContainerVeryHappy = _backgroundColor;
|
||||||
|
_satisfactionBoolean["MediumHappy"] == false;
|
||||||
|
_colorContainerMediumHappy = _backgroundColor;
|
||||||
|
_satisfactionBoolean["Happy"] == false;
|
||||||
|
_colorContainerHappy = _backgroundColor;
|
||||||
|
_satisfactionBoolean["Upset"] == false;
|
||||||
|
_colorContainerUpset = _backgroundColor;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void pressedTypeOfFeedback(String s) {
|
void pressedTypeOfFeedback(String s) {
|
||||||
|
@ -487,4 +508,15 @@ void pressedTypeOfFeedback(String s) {
|
||||||
_typeOfFeedback["Compliment"] == false;
|
_typeOfFeedback["Compliment"] == false;
|
||||||
check1 = false;
|
check1 = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (s == "clear") {
|
||||||
|
_typeOfFeedback["Mistake in sun accuracy"] == false;
|
||||||
|
check4 = false;
|
||||||
|
_typeOfFeedback["Complaint"] == false;
|
||||||
|
check2 = false;
|
||||||
|
_typeOfFeedback["Bug"] == false;
|
||||||
|
check3 = false;
|
||||||
|
_typeOfFeedback["Compliment"] == false;
|
||||||
|
check1 = false;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -2,12 +2,10 @@ class form {
|
||||||
late String satisfaction;
|
late String satisfaction;
|
||||||
late String typeOfFeedback;
|
late String typeOfFeedback;
|
||||||
late String writtenFeedback;
|
late String writtenFeedback;
|
||||||
late String timestamp;
|
|
||||||
|
|
||||||
form(String satisfaction, String typeOfFeedback, String writtenFeedback, String timestamp){
|
form(String satisfaction, String typeOfFeedback, String writtenFeedback, String timestamp){
|
||||||
this.satisfaction = satisfaction;
|
this.satisfaction = satisfaction;
|
||||||
this.typeOfFeedback = typeOfFeedback;
|
this.typeOfFeedback = typeOfFeedback;
|
||||||
this.writtenFeedback = writtenFeedback;
|
this.writtenFeedback = writtenFeedback;
|
||||||
this.timestamp = timestamp;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user