|  |  |  | @ -8,6 +8,13 @@ import 'package:mohem_flutter_app/models/marathon_question_model.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:mohem_flutter_app/ui/marathon/marathon_provider.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:provider/provider.dart'; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | List<bool> isSelectedOptions = [ | 
		
	
		
			
				|  |  |  |  |   false, | 
		
	
		
			
				|  |  |  |  |   false, | 
		
	
		
			
				|  |  |  |  |   false, | 
		
	
		
			
				|  |  |  |  |   false, | 
		
	
		
			
				|  |  |  |  | ]; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | class QuestionCard extends StatefulWidget { | 
		
	
		
			
				|  |  |  |  |   final MarathonProvider provider; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
	
		
			
				
					|  |  |  | @ -18,7 +25,7 @@ class QuestionCard extends StatefulWidget { | 
		
	
		
			
				|  |  |  |  | } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | class _QuestionCardState extends State<QuestionCard> { | 
		
	
		
			
				|  |  |  |  |   final List<QuestionContent> questionCards = <QuestionContent>[]; | 
		
	
		
			
				|  |  |  |  |   final List<CardContent> questionCards = <CardContent>[]; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   @override | 
		
	
		
			
				|  |  |  |  |   void initState() { | 
		
	
	
		
			
				
					|  |  |  | @ -29,7 +36,7 @@ class _QuestionCardState extends State<QuestionCard> { | 
		
	
		
			
				|  |  |  |  |   void _loadCards() { | 
		
	
		
			
				|  |  |  |  |     for (DummyQuestionModel question in questions) { | 
		
	
		
			
				|  |  |  |  |       questionCards.add( | 
		
	
		
			
				|  |  |  |  |         QuestionContent( | 
		
	
		
			
				|  |  |  |  |         CardContent( | 
		
	
		
			
				|  |  |  |  |           question: question, | 
		
	
		
			
				|  |  |  |  |           provider: widget.provider, | 
		
	
		
			
				|  |  |  |  |         ), | 
		
	
	
		
			
				
					|  |  |  | @ -64,11 +71,11 @@ class _QuestionCardState extends State<QuestionCard> { | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  | } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | class QuestionContent extends StatelessWidget { | 
		
	
		
			
				|  |  |  |  | class CardContent extends StatelessWidget { | 
		
	
		
			
				|  |  |  |  |   final DummyQuestionModel question; | 
		
	
		
			
				|  |  |  |  |   final MarathonProvider provider; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   const QuestionContent({ | 
		
	
		
			
				|  |  |  |  |   const CardContent({ | 
		
	
		
			
				|  |  |  |  |     Key? key, | 
		
	
		
			
				|  |  |  |  |     required this.question, | 
		
	
		
			
				|  |  |  |  |     required this.provider, | 
		
	
	
		
			
				
					|  |  |  | @ -131,12 +138,38 @@ class QuestionContent extends StatelessWidget { | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  | } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | class AnswerContent extends StatelessWidget { | 
		
	
		
			
				|  |  |  |  | class AnswerContent extends StatefulWidget { | 
		
	
		
			
				|  |  |  |  |   final DummyQuestionModel question; | 
		
	
		
			
				|  |  |  |  |   final MarathonProvider provider; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   const AnswerContent({Key? key, required this.question, required this.provider}) : super(key: key); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   @override | 
		
	
		
			
				|  |  |  |  |   State<AnswerContent> createState() => _AnswerContentState(); | 
		
	
		
			
				|  |  |  |  | } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | class _AnswerContentState extends State<AnswerContent> { | 
		
	
		
			
				|  |  |  |  |   void updateOption(int index, bool value) { | 
		
	
		
			
				|  |  |  |  |     isSelectedOptions[0] = false; | 
		
	
		
			
				|  |  |  |  |     isSelectedOptions[1] = false; | 
		
	
		
			
				|  |  |  |  |     isSelectedOptions[2] = false; | 
		
	
		
			
				|  |  |  |  |     isSelectedOptions[3] = false; | 
		
	
		
			
				|  |  |  |  |     isSelectedOptions[index] = value; | 
		
	
		
			
				|  |  |  |  |     setState(() {}); | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   Decoration getContainerColor(int index) { | 
		
	
		
			
				|  |  |  |  |     if (!isSelectedOptions[index]) { | 
		
	
		
			
				|  |  |  |  |       return MyDecorations.getContainersDecoration(MyColors.greyF7Color); | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  |     if (isSelectedOptions[index] && context.watch<MarathonProvider>().start > 0) { | 
		
	
		
			
				|  |  |  |  |       return MyDecorations.getContainersDecoration(MyColors.yellowColorII); | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  |     return MyDecorations.getContainersDecoration( | 
		
	
		
			
				|  |  |  |  |       isSelectedOptions[index] ? MyColors.greenColor : MyColors.greyF7Color, | 
		
	
		
			
				|  |  |  |  |     ); | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   @override | 
		
	
		
			
				|  |  |  |  |   Widget build(BuildContext context) { | 
		
	
		
			
				|  |  |  |  |     return Container( | 
		
	
	
		
			
				
					|  |  |  | @ -155,29 +188,27 @@ class AnswerContent extends StatelessWidget { | 
		
	
		
			
				|  |  |  |  |         children: <Widget>[ | 
		
	
		
			
				|  |  |  |  |           InkWell( | 
		
	
		
			
				|  |  |  |  |             onTap: () { | 
		
	
		
			
				|  |  |  |  |               if (provider.currentQuestionNumber == 9) { | 
		
	
		
			
				|  |  |  |  |                 provider.cancelTimer(); | 
		
	
		
			
				|  |  |  |  |                 provider.resetValues(); | 
		
	
		
			
				|  |  |  |  |               if (widget.provider.currentQuestionNumber == 9) { | 
		
	
		
			
				|  |  |  |  |                 widget.provider.cancelTimer(); | 
		
	
		
			
				|  |  |  |  |                 widget.provider.resetValues(); | 
		
	
		
			
				|  |  |  |  |                 Navigator.pushReplacementNamed( | 
		
	
		
			
				|  |  |  |  |                   context, | 
		
	
		
			
				|  |  |  |  |                   AppRoutes.marathonWinnerSelection, | 
		
	
		
			
				|  |  |  |  |                 ); | 
		
	
		
			
				|  |  |  |  |                 return; | 
		
	
		
			
				|  |  |  |  |               } | 
		
	
		
			
				|  |  |  |  |               provider.cancelTimer(); | 
		
	
		
			
				|  |  |  |  |               provider.startTimer(context); | 
		
	
		
			
				|  |  |  |  |               provider.swipeCardLeft(); | 
		
	
		
			
				|  |  |  |  |               updateOption(0, true); | 
		
	
		
			
				|  |  |  |  |             }, | 
		
	
		
			
				|  |  |  |  |             child: Container( | 
		
	
		
			
				|  |  |  |  |               height: 60, | 
		
	
		
			
				|  |  |  |  |               width: MediaQuery.of(context).size.width - 75, | 
		
	
		
			
				|  |  |  |  |               alignment: Alignment.centerLeft, | 
		
	
		
			
				|  |  |  |  |               decoration: MyDecorations.answerContainerDecoration, | 
		
	
		
			
				|  |  |  |  |               decoration: getContainerColor(0), | 
		
	
		
			
				|  |  |  |  |               child: Center( | 
		
	
		
			
				|  |  |  |  |                 child: Text( | 
		
	
		
			
				|  |  |  |  |                   question.opt1!, | 
		
	
		
			
				|  |  |  |  |                   style: const TextStyle( | 
		
	
		
			
				|  |  |  |  |                     color: MyColors.darkTextColor, | 
		
	
		
			
				|  |  |  |  |                   widget.question.opt1!, | 
		
	
		
			
				|  |  |  |  |                   style: TextStyle( | 
		
	
		
			
				|  |  |  |  |                     color: isSelectedOptions[0] ? MyColors.white : MyColors.darkTextColor, | 
		
	
		
			
				|  |  |  |  |                     fontWeight: FontWeight.w600, | 
		
	
		
			
				|  |  |  |  |                     fontSize: 16, | 
		
	
		
			
				|  |  |  |  |                   ), | 
		
	
	
		
			
				
					|  |  |  | @ -188,29 +219,27 @@ class AnswerContent extends StatelessWidget { | 
		
	
		
			
				|  |  |  |  |           const SizedBox(height: 15), | 
		
	
		
			
				|  |  |  |  |           InkWell( | 
		
	
		
			
				|  |  |  |  |             onTap: () { | 
		
	
		
			
				|  |  |  |  |               if (provider.currentQuestionNumber == 9) { | 
		
	
		
			
				|  |  |  |  |                 provider.cancelTimer(); | 
		
	
		
			
				|  |  |  |  |                 provider.resetValues(); | 
		
	
		
			
				|  |  |  |  |               if (widget.provider.currentQuestionNumber == 9) { | 
		
	
		
			
				|  |  |  |  |                 widget.provider.cancelTimer(); | 
		
	
		
			
				|  |  |  |  |                 widget.provider.resetValues(); | 
		
	
		
			
				|  |  |  |  |                 Navigator.pushReplacementNamed( | 
		
	
		
			
				|  |  |  |  |                   context, | 
		
	
		
			
				|  |  |  |  |                   AppRoutes.marathonWinnerSelection, | 
		
	
		
			
				|  |  |  |  |                 ); | 
		
	
		
			
				|  |  |  |  |                 return; | 
		
	
		
			
				|  |  |  |  |               } | 
		
	
		
			
				|  |  |  |  |               provider.cancelTimer(); | 
		
	
		
			
				|  |  |  |  |               provider.startTimer(context); | 
		
	
		
			
				|  |  |  |  |               provider.swipeCardLeft(); | 
		
	
		
			
				|  |  |  |  |               updateOption(1, true); | 
		
	
		
			
				|  |  |  |  |             }, | 
		
	
		
			
				|  |  |  |  |             child: Container( | 
		
	
		
			
				|  |  |  |  |               height: 60, | 
		
	
		
			
				|  |  |  |  |               width: MediaQuery.of(context).size.width - 75, | 
		
	
		
			
				|  |  |  |  |               alignment: Alignment.centerLeft, | 
		
	
		
			
				|  |  |  |  |               decoration: MyDecorations.answerContainerDecoration, | 
		
	
		
			
				|  |  |  |  |               decoration: getContainerColor(1), | 
		
	
		
			
				|  |  |  |  |               child: Center( | 
		
	
		
			
				|  |  |  |  |                 child: Text( | 
		
	
		
			
				|  |  |  |  |                   question.opt2!, | 
		
	
		
			
				|  |  |  |  |                   style: const TextStyle( | 
		
	
		
			
				|  |  |  |  |                     color: MyColors.darkTextColor, | 
		
	
		
			
				|  |  |  |  |                   widget.question.opt2!, | 
		
	
		
			
				|  |  |  |  |                   style: TextStyle( | 
		
	
		
			
				|  |  |  |  |                     color: isSelectedOptions[1] ? MyColors.white : MyColors.darkTextColor, | 
		
	
		
			
				|  |  |  |  |                     fontWeight: FontWeight.w600, | 
		
	
		
			
				|  |  |  |  |                     fontSize: 16, | 
		
	
		
			
				|  |  |  |  |                   ), | 
		
	
	
		
			
				
					|  |  |  | @ -221,29 +250,27 @@ class AnswerContent extends StatelessWidget { | 
		
	
		
			
				|  |  |  |  |           const SizedBox(height: 15), | 
		
	
		
			
				|  |  |  |  |           InkWell( | 
		
	
		
			
				|  |  |  |  |             onTap: () { | 
		
	
		
			
				|  |  |  |  |               if (provider.currentQuestionNumber == 9) { | 
		
	
		
			
				|  |  |  |  |                 provider.cancelTimer(); | 
		
	
		
			
				|  |  |  |  |                 provider.resetValues(); | 
		
	
		
			
				|  |  |  |  |               if (widget.provider.currentQuestionNumber == 9) { | 
		
	
		
			
				|  |  |  |  |                 widget.provider.cancelTimer(); | 
		
	
		
			
				|  |  |  |  |                 widget.provider.resetValues(); | 
		
	
		
			
				|  |  |  |  |                 Navigator.pushReplacementNamed( | 
		
	
		
			
				|  |  |  |  |                   context, | 
		
	
		
			
				|  |  |  |  |                   AppRoutes.marathonWinnerSelection, | 
		
	
		
			
				|  |  |  |  |                 ); | 
		
	
		
			
				|  |  |  |  |                 return; | 
		
	
		
			
				|  |  |  |  |               } | 
		
	
		
			
				|  |  |  |  |               provider.cancelTimer(); | 
		
	
		
			
				|  |  |  |  |               provider.startTimer(context); | 
		
	
		
			
				|  |  |  |  |               provider.swipeCardLeft(); | 
		
	
		
			
				|  |  |  |  |               updateOption(2, true); | 
		
	
		
			
				|  |  |  |  |             }, | 
		
	
		
			
				|  |  |  |  |             child: Container( | 
		
	
		
			
				|  |  |  |  |               height: 60, | 
		
	
		
			
				|  |  |  |  |               width: MediaQuery.of(context).size.width - 75, | 
		
	
		
			
				|  |  |  |  |               alignment: Alignment.centerLeft, | 
		
	
		
			
				|  |  |  |  |               decoration: MyDecorations.answerContainerDecoration, | 
		
	
		
			
				|  |  |  |  |               decoration: getContainerColor(2), | 
		
	
		
			
				|  |  |  |  |               child: Center( | 
		
	
		
			
				|  |  |  |  |                 child: Text( | 
		
	
		
			
				|  |  |  |  |                   question.opt3!, | 
		
	
		
			
				|  |  |  |  |                   style: const TextStyle( | 
		
	
		
			
				|  |  |  |  |                     color: MyColors.darkTextColor, | 
		
	
		
			
				|  |  |  |  |                   widget.question.opt3!, | 
		
	
		
			
				|  |  |  |  |                   style: TextStyle( | 
		
	
		
			
				|  |  |  |  |                     color: isSelectedOptions[2] ? MyColors.white : MyColors.darkTextColor, | 
		
	
		
			
				|  |  |  |  |                     fontWeight: FontWeight.w600, | 
		
	
		
			
				|  |  |  |  |                     fontSize: 16, | 
		
	
		
			
				|  |  |  |  |                   ), | 
		
	
	
		
			
				
					|  |  |  | @ -254,29 +281,27 @@ class AnswerContent extends StatelessWidget { | 
		
	
		
			
				|  |  |  |  |           const SizedBox(height: 15), | 
		
	
		
			
				|  |  |  |  |           InkWell( | 
		
	
		
			
				|  |  |  |  |             onTap: () { | 
		
	
		
			
				|  |  |  |  |               if (provider.currentQuestionNumber == 9) { | 
		
	
		
			
				|  |  |  |  |                 provider.cancelTimer(); | 
		
	
		
			
				|  |  |  |  |                 provider.resetValues(); | 
		
	
		
			
				|  |  |  |  |               if (widget.provider.currentQuestionNumber == 9) { | 
		
	
		
			
				|  |  |  |  |                 widget.provider.cancelTimer(); | 
		
	
		
			
				|  |  |  |  |                 widget.provider.resetValues(); | 
		
	
		
			
				|  |  |  |  |                 Navigator.pushReplacementNamed( | 
		
	
		
			
				|  |  |  |  |                   context, | 
		
	
		
			
				|  |  |  |  |                   AppRoutes.marathonWinnerSelection, | 
		
	
		
			
				|  |  |  |  |                 ); | 
		
	
		
			
				|  |  |  |  |                 return; | 
		
	
		
			
				|  |  |  |  |               } | 
		
	
		
			
				|  |  |  |  |               provider.cancelTimer(); | 
		
	
		
			
				|  |  |  |  |               provider.startTimer(context); | 
		
	
		
			
				|  |  |  |  |               provider.swipeCardLeft(); | 
		
	
		
			
				|  |  |  |  |               updateOption(3, true); | 
		
	
		
			
				|  |  |  |  |             }, | 
		
	
		
			
				|  |  |  |  |             child: Container( | 
		
	
		
			
				|  |  |  |  |               height: 60, | 
		
	
		
			
				|  |  |  |  |               width: MediaQuery.of(context).size.width - 75, | 
		
	
		
			
				|  |  |  |  |               alignment: Alignment.centerLeft, | 
		
	
		
			
				|  |  |  |  |               decoration: MyDecorations.answerContainerDecoration, | 
		
	
		
			
				|  |  |  |  |               decoration: getContainerColor(3), | 
		
	
		
			
				|  |  |  |  |               child: Center( | 
		
	
		
			
				|  |  |  |  |                 child: Text( | 
		
	
		
			
				|  |  |  |  |                   question.opt3!, | 
		
	
		
			
				|  |  |  |  |                   style: const TextStyle( | 
		
	
		
			
				|  |  |  |  |                     color: MyColors.darkTextColor, | 
		
	
		
			
				|  |  |  |  |                   widget.question.opt3!, | 
		
	
		
			
				|  |  |  |  |                   style: TextStyle( | 
		
	
		
			
				|  |  |  |  |                     color: isSelectedOptions[3] ? MyColors.white : MyColors.darkTextColor, | 
		
	
		
			
				|  |  |  |  |                     fontWeight: FontWeight.w600, | 
		
	
		
			
				|  |  |  |  |                     fontSize: 16, | 
		
	
		
			
				|  |  |  |  |                   ), | 
		
	
	
		
			
				
					|  |  |  | 
 |