Advertisement
Guest User

Untitled

a guest
Sep 16th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.08 KB | None | 0 0
  1. Widget submitButton() {
  2. if (!hasAnswer) {
  3. return Container(
  4. height: 40.0,
  5. width: double.maxFinite,
  6. padding: EdgeInsets.symmetric(horizontal:10.0),
  7. child: RaisedButton(
  8. color: Color(SECONDARY_COLOR),
  9. onPressed: () {
  10. setState(() {
  11. if(healt == 1 && choice != questions.answer){
  12. widget.onSubmit();
  13. hasAnswer = true;
  14. }
  15. if(choice == questions.answer){
  16. btnChoice = "";
  17. answer = questions.answer;
  18. widget.onSubmit();
  19. hasAnswer = true;
  20. }else{
  21. healt += 1;
  22. hasAnswer = true;
  23. }
  24. });
  25.  
  26. },
  27. child: Text(
  28. 'Submit',
  29. style: TextStyle(color: Colors.white),
  30. ),
  31. ),
  32. );
  33. }else {
  34. print('Not Answer');
  35. }
  36. return Container(
  37. width: double.maxFinite,
  38. child: Card(
  39. child: Column(
  40. crossAxisAlignment: CrossAxisAlignment.start,
  41. children: <Widget>[
  42. Padding(
  43. padding: const EdgeInsets.all(10.0),
  44. child: H4(value: healt == 2
  45. ? 'Failed'
  46. : choice == questions.answer
  47. ? 'Answer :' : 'Try Again'),
  48. ),
  49. Padding(
  50. padding: const EdgeInsets.all(10.0),
  51. child: Text(
  52. questions.answer == 'optA' && choice == questions.answer
  53. ? questions.optA
  54. : questions.answer == 'optB' && choice == questions.answer
  55. ? questions.optB
  56. : questions.answer == 'optC' && choice == questions.answer
  57. ? questions.optC
  58. : questions.answer == 'optD' && choice == questions.answer
  59. ? questions.optD
  60. : healt == 2
  61. ? "Wrong answer"
  62. : "Wrong Answer, you have one more chance",
  63. ),
  64. ),
  65. ],
  66. ),
  67. ),
  68. );
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement