Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Widget submitButton() {
- if (!hasAnswer) {
- return Container(
- height: 40.0,
- width: double.maxFinite,
- padding: EdgeInsets.symmetric(horizontal:10.0),
- child: RaisedButton(
- color: Color(SECONDARY_COLOR),
- onPressed: () {
- setState(() {
- if(healt == 1 && choice != questions.answer){
- widget.onSubmit();
- hasAnswer = true;
- }
- if(choice == questions.answer){
- btnChoice = "";
- answer = questions.answer;
- widget.onSubmit();
- hasAnswer = true;
- }else{
- healt += 1;
- hasAnswer = true;
- }
- });
- },
- child: Text(
- 'Submit',
- style: TextStyle(color: Colors.white),
- ),
- ),
- );
- }else {
- print('Not Answer');
- }
- return Container(
- width: double.maxFinite,
- child: Card(
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: <Widget>[
- Padding(
- padding: const EdgeInsets.all(10.0),
- child: H4(value: healt == 2
- ? 'Failed'
- : choice == questions.answer
- ? 'Answer :' : 'Try Again'),
- ),
- Padding(
- padding: const EdgeInsets.all(10.0),
- child: Text(
- questions.answer == 'optA' && choice == questions.answer
- ? questions.optA
- : questions.answer == 'optB' && choice == questions.answer
- ? questions.optB
- : questions.answer == 'optC' && choice == questions.answer
- ? questions.optC
- : questions.answer == 'optD' && choice == questions.answer
- ? questions.optD
- : healt == 2
- ? "Wrong answer"
- : "Wrong Answer, you have one more chance",
- ),
- ),
- ],
- ),
- ),
- );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement