|
|
|
@ -22,6 +22,7 @@ import 'package:mohem_flutter_app/ui/marathon/widgets/marathon_qualifiers_contai
|
|
|
|
import 'package:mohem_flutter_app/ui/marathon/widgets/question_card.dart';
|
|
|
|
import 'package:mohem_flutter_app/ui/marathon/widgets/question_card.dart';
|
|
|
|
import 'package:mohem_flutter_app/ui/marathon/widgets/question_card_builder.dart';
|
|
|
|
import 'package:mohem_flutter_app/ui/marathon/widgets/question_card_builder.dart';
|
|
|
|
import 'package:mohem_flutter_app/widgets/app_bar_widget.dart';
|
|
|
|
import 'package:mohem_flutter_app/widgets/app_bar_widget.dart';
|
|
|
|
|
|
|
|
import 'package:mohem_flutter_app/widgets/button/default_button.dart';
|
|
|
|
import 'package:mohem_flutter_app/widgets/dialogs/confirm_dialog.dart';
|
|
|
|
import 'package:mohem_flutter_app/widgets/dialogs/confirm_dialog.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
|
|
|
|
@ -197,57 +198,74 @@ class MarathonScreen extends StatelessWidget {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
body: SingleChildScrollView(
|
|
|
|
body: Column(
|
|
|
|
child: Column(
|
|
|
|
children: <Widget>[
|
|
|
|
children: <Widget>[
|
|
|
|
ListView(
|
|
|
|
20.height,
|
|
|
|
children: [
|
|
|
|
if (provider.questionCardStatus == QuestionCardStatus.findingWinner) ...<Widget>[
|
|
|
|
20.height,
|
|
|
|
QualifiersContainer(provider: provider).paddingOnly(left: 21, right: 21),
|
|
|
|
if (provider.questionCardStatus == QuestionCardStatus.findingWinner) ...<Widget>[
|
|
|
|
] else if (provider.questionCardStatus == QuestionCardStatus.winnerFound)
|
|
|
|
QualifiersContainer(provider: provider).paddingOnly(left: 21, right: 21),
|
|
|
|
...<Widget>[]
|
|
|
|
] else if (provider.questionCardStatus == QuestionCardStatus.winnerFound)
|
|
|
|
else ...<Widget>[
|
|
|
|
...<Widget>[]
|
|
|
|
MarathonProgressContainer(provider: provider).paddingOnly(left: 21, right: 21),
|
|
|
|
else ...<Widget>[
|
|
|
|
],
|
|
|
|
MarathonProgressContainer(provider: provider).paddingOnly(left: 21, right: 21),
|
|
|
|
if (provider.questionCardStatus == QuestionCardStatus.findingWinner) ...<Widget>[
|
|
|
|
],
|
|
|
|
getNameContainer(context),
|
|
|
|
if (provider.questionCardStatus == QuestionCardStatus.findingWinner) ...<Widget>[
|
|
|
|
|
|
|
|
getNameContainer(context),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
QuestionCardBuilder(
|
|
|
|
|
|
|
|
onQuestion: (BuildContext context) => const QuestionCard(),
|
|
|
|
|
|
|
|
onCompleted: (BuildContext context) => CustomStatusWidget(
|
|
|
|
|
|
|
|
asset: Lottie.asset(MyLottieConsts.allQuestions, height: 200),
|
|
|
|
|
|
|
|
title: LocaleKeys.congrats.tr().toText22(color: MyColors.greenColor),
|
|
|
|
|
|
|
|
subTitle: LocaleKeys.allQuestionsCorrect.toText18(color: MyColors.darkTextColor, isCentered: true),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
onCorrectAnswer: (BuildContext context) => CustomStatusWidget(
|
|
|
|
|
|
|
|
asset: getSuccessWidget(gapType: provider.gapTimeType, gapImage: provider.gapTimeImage, gapText: provider.gapTimeText),
|
|
|
|
|
|
|
|
title: LocaleKeys.congrats.tr().toText22(color: MyColors.greenColor),
|
|
|
|
|
|
|
|
subTitle: LocaleKeys.yourAnswerCorrect.tr().toText18(color: MyColors.darkTextColor, isCentered: true),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
onWinner: (BuildContext context) => getWinnerWidget(context, provider: provider),
|
|
|
|
|
|
|
|
onWrongAnswer: (BuildContext context) => CustomStatusWidget(
|
|
|
|
|
|
|
|
asset: Image.asset(MyLottieConsts.wrongAnswerGif, height: 200),
|
|
|
|
|
|
|
|
title: LocaleKeys.oops.tr().toText22(color: MyColors.redColor),
|
|
|
|
|
|
|
|
subTitle: LocaleKeys.wrongAnswer.tr().toText18(color: MyColors.darkTextColor, isCentered: true),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
onSkippedAnswer: (BuildContext context) => CustomStatusWidget(
|
|
|
|
|
|
|
|
asset: Image.asset(MyLottieConsts.wrongAnswerGif, height: 200),
|
|
|
|
|
|
|
|
title: LocaleKeys.oops.tr().toText22(color: MyColors.redColor),
|
|
|
|
|
|
|
|
subTitle: LocaleKeys.youMissedTheQuestion.tr().toText18(color: MyColors.darkTextColor, isCentered: true),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
onFindingWinner: (BuildContext context) => CustomStatusWidget(
|
|
|
|
|
|
|
|
asset: Lottie.asset(MyLottieConsts.winnerLottie, height: 168),
|
|
|
|
|
|
|
|
title: LocaleKeys.fingersCrossed.tr().toText22(color: MyColors.greenColor),
|
|
|
|
|
|
|
|
subTitle: LocaleKeys.winnerSelectedRandomly.tr().toText18(color: MyColors.darkTextColor, isCentered: true),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
questionCardStatus: provider.questionCardStatus,
|
|
|
|
|
|
|
|
).paddingOnly(top: 12, left: 21, right: 21),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
QuestionCardBuilder(
|
|
|
|
).expanded,
|
|
|
|
onQuestion: (BuildContext context) => const QuestionCard(),
|
|
|
|
provider.questionCardStatus == QuestionCardStatus.winnerFound
|
|
|
|
onCompleted: (BuildContext context) => CustomStatusWidget(
|
|
|
|
? DefaultButton(LocaleKeys.ok.tr(), () {
|
|
|
|
asset: Lottie.asset(MyLottieConsts.allQuestions, height: 200),
|
|
|
|
provider.resetValues();
|
|
|
|
title: LocaleKeys.congrats.tr().toText22(color: MyColors.greenColor),
|
|
|
|
Navigator.of(context).popUntil(ModalRoute.withName(AppRoutes.dashboard));
|
|
|
|
subTitle: LocaleKeys.allQuestionsCorrect.toText18(color: MyColors.darkTextColor, isCentered: true),
|
|
|
|
}).insideContainer
|
|
|
|
),
|
|
|
|
: const SizedBox()
|
|
|
|
onCorrectAnswer: (BuildContext context) => CustomStatusWidget(
|
|
|
|
],
|
|
|
|
asset: getSuccessWidget(gapType: provider.currentQuestion.gapType, gapImage: provider.currentQuestion.gapImage, gapText: provider.currentQuestion.gapText),
|
|
|
|
|
|
|
|
title: LocaleKeys.congrats.tr().toText22(color: MyColors.greenColor),
|
|
|
|
|
|
|
|
subTitle: LocaleKeys.yourAnswerCorrect.toText18(color: MyColors.darkTextColor, isCentered: true),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
onWinner: (BuildContext context) => getWinnerWidget(context, provider: provider),
|
|
|
|
|
|
|
|
onWrongAnswer: (BuildContext context) => CustomStatusWidget(
|
|
|
|
|
|
|
|
asset: Image.asset(MyLottieConsts.wrongAnswerGif, height: 200),
|
|
|
|
|
|
|
|
title: LocaleKeys.oops.tr().toText22(color: MyColors.redColor),
|
|
|
|
|
|
|
|
subTitle: LocaleKeys.wrongAnswer.tr().toText18(color: MyColors.darkTextColor, isCentered: true),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
onSkippedAnswer: (BuildContext context) => CustomStatusWidget(
|
|
|
|
|
|
|
|
asset: Image.asset(MyLottieConsts.wrongAnswerGif, height: 200),
|
|
|
|
|
|
|
|
title: LocaleKeys.oops.tr().toText22(color: MyColors.redColor),
|
|
|
|
|
|
|
|
subTitle: LocaleKeys.youMissedTheQuestion.tr().toText18(color: MyColors.darkTextColor, isCentered: true),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
onFindingWinner: (BuildContext context) => CustomStatusWidget(
|
|
|
|
|
|
|
|
asset: Lottie.asset(MyLottieConsts.winnerLottie, height: 168),
|
|
|
|
|
|
|
|
title: LocaleKeys.fingersCrossed.tr().toText22(color: MyColors.greenColor),
|
|
|
|
|
|
|
|
subTitle: LocaleKeys.winnerSelectedRandomly.tr().toText18(color: MyColors.darkTextColor, isCentered: true),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
questionCardStatus: provider.questionCardStatus,
|
|
|
|
|
|
|
|
).paddingOnly(top: 12, left: 21, right: 21),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
onWillPop: () {
|
|
|
|
onWillPop: () {
|
|
|
|
provider.resetValues();
|
|
|
|
showDialog(
|
|
|
|
return Future<bool>.value(true);
|
|
|
|
context: context,
|
|
|
|
|
|
|
|
builder: (BuildContext context) => ConfirmDialog(
|
|
|
|
|
|
|
|
message: LocaleKeys.youWantToLeaveMarathon.tr(),
|
|
|
|
|
|
|
|
onTap: () {
|
|
|
|
|
|
|
|
provider.resetValues();
|
|
|
|
|
|
|
|
Navigator.of(context).popUntil(ModalRoute.withName(AppRoutes.dashboard));
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
return Future<bool>.value(false);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|