Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. List<String> options =
  2. List<String>.from(documentList[currentQuestionIndex]["options"]);
  3. for (int i = 0; i < options.length; i++) {
  4. widgets.add(
  5. ListTile(
  6. title: Text("${(i + 1).toString()}. ${options[i]}.",style: TextStyle(color: Colors.white),)
  7. ,onTap: () {questionNumber++;
  8. bool correct =
  9. (documentList[currentQuestionIndex]["answer"] == options[i]);
  10. if (documentList[currentQuestionIndex]["guesses"] == null) {
  11. documentList[currentQuestionIndex]["guesses"] = 1;
  12.  
  13. } else {
  14. documentList[currentQuestionIndex]["guesses"] += 1;
  15. }
  16.  
  17. if (documentList[currentQuestionIndex]["correct-guesses"] == null) {
  18. documentList[currentQuestionIndex]["correct-guesses"] = 0;
  19. }
  20. if (correct) {
  21. documentList[currentQuestionIndex]["correct-guesses"] += 1;
  22. finalScore++;
  23. }
  24. onQuestionAnswered(currentQuestionIndex);
  25.  
  26.  
  27. },
  28. ));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement