|
|
|
@ -6,18 +6,13 @@ import 'package:mohem_flutter_app/app_state/app_state.dart';
|
|
|
|
import 'package:mohem_flutter_app/classes/colors.dart';
|
|
|
|
import 'package:mohem_flutter_app/classes/colors.dart';
|
|
|
|
import 'package:mohem_flutter_app/classes/decorations_helper.dart';
|
|
|
|
import 'package:mohem_flutter_app/classes/decorations_helper.dart';
|
|
|
|
import 'package:mohem_flutter_app/classes/lottie_consts.dart';
|
|
|
|
import 'package:mohem_flutter_app/classes/lottie_consts.dart';
|
|
|
|
|
|
|
|
import 'package:mohem_flutter_app/extensions/int_extensions.dart';
|
|
|
|
|
|
|
|
import 'package:mohem_flutter_app/extensions/string_extensions.dart';
|
|
|
|
import 'package:mohem_flutter_app/extensions/widget_extensions.dart';
|
|
|
|
import 'package:mohem_flutter_app/extensions/widget_extensions.dart';
|
|
|
|
import 'package:mohem_flutter_app/models/marathon/question_model.dart';
|
|
|
|
import 'package:mohem_flutter_app/models/marathon/question_model.dart';
|
|
|
|
import 'package:mohem_flutter_app/ui/marathon/marathon_provider.dart';
|
|
|
|
import 'package:mohem_flutter_app/ui/marathon/marathon_provider.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
|
|
|
|
List<bool> isSelectedOptions = [
|
|
|
|
|
|
|
|
false,
|
|
|
|
|
|
|
|
false,
|
|
|
|
|
|
|
|
false,
|
|
|
|
|
|
|
|
false,
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class QuestionCard extends StatelessWidget {
|
|
|
|
class QuestionCard extends StatelessWidget {
|
|
|
|
final MarathonProvider provider;
|
|
|
|
final MarathonProvider provider;
|
|
|
|
|
|
|
|
|
|
|
|
@ -113,8 +108,6 @@ class CardContent extends StatelessWidget {
|
|
|
|
class AnswerContent extends StatelessWidget {
|
|
|
|
class AnswerContent extends StatelessWidget {
|
|
|
|
const AnswerContent({Key? key}) : super(key: key);
|
|
|
|
const AnswerContent({Key? key}) : super(key: key);
|
|
|
|
|
|
|
|
|
|
|
|
void onAnswerTapped(BuildContext context, QuestionOptions questionOption) {}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
MarathonProvider provider = context.watch<MarathonProvider>();
|
|
|
|
MarathonProvider provider = context.watch<MarathonProvider>();
|
|
|
|
@ -128,7 +121,7 @@ class AnswerContent extends StatelessWidget {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
child: provider.currentQuestion.questionOptions != null
|
|
|
|
child: provider.currentQuestion.questionOptions != null
|
|
|
|
? ListView.builder(
|
|
|
|
? ListView.separated(
|
|
|
|
itemCount: provider.currentQuestion.questionOptions!.length,
|
|
|
|
itemCount: provider.currentQuestion.questionOptions!.length,
|
|
|
|
shrinkWrap: true,
|
|
|
|
shrinkWrap: true,
|
|
|
|
itemBuilder: (BuildContext context, int index) {
|
|
|
|
itemBuilder: (BuildContext context, int index) {
|
|
|
|
@ -139,13 +132,8 @@ class AnswerContent extends StatelessWidget {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
);
|
|
|
|
);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
separatorBuilder: (BuildContext context, int index) => 15.height,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
// Column(
|
|
|
|
|
|
|
|
// mainAxisSize: MainAxisSize.min,
|
|
|
|
|
|
|
|
// mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
|
|
|
// crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
|
|
|
// children: question.questionOptions!.map((QuestionOptions e) => AnswerTileForText(questionOption: e, onAnswerTapped: () {})).toList(),
|
|
|
|
|
|
|
|
// )
|
|
|
|
|
|
|
|
: const SizedBox(),
|
|
|
|
: const SizedBox(),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -157,18 +145,6 @@ class AnswerTileForText extends StatelessWidget {
|
|
|
|
|
|
|
|
|
|
|
|
const AnswerTileForText({Key? key, required this.index, required this.onAnswerTapped}) : super(key: key);
|
|
|
|
const AnswerTileForText({Key? key, required this.index, required this.onAnswerTapped}) : super(key: key);
|
|
|
|
|
|
|
|
|
|
|
|
// Decoration getContainerColor(int index) {
|
|
|
|
|
|
|
|
// if (!isSelectedOptions[index]) {
|
|
|
|
|
|
|
|
// return MyDecorations.getContainersDecoration(MyColors.greyF7Color);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// if (isSelectedOptions[index] && context.watch<MarathonProvider>().currentGapTime > 0) {
|
|
|
|
|
|
|
|
// return MyDecorations.getContainersDecoration(MyColors.yellowColorII);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// return MyDecorations.getContainersDecoration(
|
|
|
|
|
|
|
|
// isSelectedOptions[index] ? MyColors.greenColor : MyColors.greyF7Color,
|
|
|
|
|
|
|
|
// );
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
MarathonProvider provider = context.watch<MarathonProvider>();
|
|
|
|
MarathonProvider provider = context.watch<MarathonProvider>();
|
|
|
|
@ -180,132 +156,13 @@ class AnswerTileForText extends StatelessWidget {
|
|
|
|
alignment: Alignment.centerLeft,
|
|
|
|
alignment: Alignment.centerLeft,
|
|
|
|
decoration: MyDecorations.getAnswersContainerColor(provider.currentQuestion.questionOptions![index].optionStatus!),
|
|
|
|
decoration: MyDecorations.getAnswersContainerColor(provider.currentQuestion.questionOptions![index].optionStatus!),
|
|
|
|
child: Center(
|
|
|
|
child: Center(
|
|
|
|
child: Text(
|
|
|
|
child: (AppState().isArabic(context) ? provider.currentQuestion.questionOptions![index].titleAr! : provider.currentQuestion.questionOptions![index].titleEn!)
|
|
|
|
AppState().isArabic(context) ? provider.currentQuestion.questionOptions![index].titleAr! : provider.currentQuestion.questionOptions![index].titleEn!,
|
|
|
|
.toText16(
|
|
|
|
style: TextStyle(
|
|
|
|
|
|
|
|
color: provider.currentQuestion.questionOptions![index].optionStatus == QuestionsOptionStatus.unSelected ? MyColors.darkTextColor : MyColors.white,
|
|
|
|
color: provider.currentQuestion.questionOptions![index].optionStatus == QuestionsOptionStatus.unSelected ? MyColors.darkTextColor : MyColors.white,
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
)
|
|
|
|
fontSize: 16,
|
|
|
|
.paddingOnly(top: 17, bottom: 17),
|
|
|
|
),
|
|
|
|
|
|
|
|
).paddingOnly(top: 17, bottom: 17),
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
).paddingOnly(top: 8, bottom: 8);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// InkWell(
|
|
|
|
|
|
|
|
// onTap: () {
|
|
|
|
|
|
|
|
// if (widget.provider.currentQuestionNumber == 9) {
|
|
|
|
|
|
|
|
// widget.provider.cancelTimer();
|
|
|
|
|
|
|
|
// widget.provider.resetValues();
|
|
|
|
|
|
|
|
// Navigator.pushReplacementNamed(
|
|
|
|
|
|
|
|
// context,
|
|
|
|
|
|
|
|
// AppRoutes.marathonWinnerSelection,
|
|
|
|
|
|
|
|
// );
|
|
|
|
|
|
|
|
// return;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// updateOption(0, true);
|
|
|
|
|
|
|
|
// },
|
|
|
|
|
|
|
|
// child: Container(
|
|
|
|
|
|
|
|
// alignment: Alignment.centerLeft,
|
|
|
|
|
|
|
|
// decoration: getContainerColor(0),
|
|
|
|
|
|
|
|
// child: Center(
|
|
|
|
|
|
|
|
// child: Text(
|
|
|
|
|
|
|
|
// widget.question.questionOptions![0].titleEn!,
|
|
|
|
|
|
|
|
// style: TextStyle(
|
|
|
|
|
|
|
|
// color: isSelectedOptions[0] ? MyColors.white : MyColors.darkTextColor,
|
|
|
|
|
|
|
|
// fontWeight: FontWeight.w600,
|
|
|
|
|
|
|
|
// fontSize: 16,
|
|
|
|
|
|
|
|
// ),
|
|
|
|
|
|
|
|
// ).paddingOnly(top: 17, bottom: 17),
|
|
|
|
|
|
|
|
// ),
|
|
|
|
|
|
|
|
// ),
|
|
|
|
|
|
|
|
// ),
|
|
|
|
|
|
|
|
// const SizedBox(height: 15),
|
|
|
|
|
|
|
|
// InkWell(
|
|
|
|
|
|
|
|
// onTap: () {
|
|
|
|
|
|
|
|
// if (widget.provider.currentQuestionNumber == 9) {
|
|
|
|
|
|
|
|
// widget.provider.cancelTimer();
|
|
|
|
|
|
|
|
// widget.provider.resetValues();
|
|
|
|
|
|
|
|
// Navigator.pushReplacementNamed(
|
|
|
|
|
|
|
|
// context,
|
|
|
|
|
|
|
|
// AppRoutes.marathonWinnerSelection,
|
|
|
|
|
|
|
|
// );
|
|
|
|
|
|
|
|
// return;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// updateOption(1, true);
|
|
|
|
|
|
|
|
// },
|
|
|
|
|
|
|
|
// child: Container(
|
|
|
|
|
|
|
|
// alignment: Alignment.centerLeft,
|
|
|
|
|
|
|
|
// decoration: getContainerColor(1),
|
|
|
|
|
|
|
|
// child: Center(
|
|
|
|
|
|
|
|
// child: Text(
|
|
|
|
|
|
|
|
// widget.question.questionOptions![1].titleEn!,
|
|
|
|
|
|
|
|
// style: TextStyle(
|
|
|
|
|
|
|
|
// color: isSelectedOptions[1] ? MyColors.white : MyColors.darkTextColor,
|
|
|
|
|
|
|
|
// fontWeight: FontWeight.w600,
|
|
|
|
|
|
|
|
// fontSize: 16,
|
|
|
|
|
|
|
|
// ),
|
|
|
|
|
|
|
|
// ).paddingOnly(top: 17, bottom: 17),
|
|
|
|
|
|
|
|
// ),
|
|
|
|
|
|
|
|
// ),
|
|
|
|
|
|
|
|
// ),
|
|
|
|
|
|
|
|
// const SizedBox(height: 15),
|
|
|
|
|
|
|
|
// InkWell(
|
|
|
|
|
|
|
|
// onTap: () {
|
|
|
|
|
|
|
|
// if (widget.provider.currentQuestionNumber == 9) {
|
|
|
|
|
|
|
|
// widget.provider.cancelTimer();
|
|
|
|
|
|
|
|
// widget.provider.resetValues();
|
|
|
|
|
|
|
|
// Navigator.pushReplacementNamed(
|
|
|
|
|
|
|
|
// context,
|
|
|
|
|
|
|
|
// AppRoutes.marathonWinnerSelection,
|
|
|
|
|
|
|
|
// );
|
|
|
|
|
|
|
|
// return;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// updateOption(2, true);
|
|
|
|
|
|
|
|
// },
|
|
|
|
|
|
|
|
// child: Container(
|
|
|
|
|
|
|
|
// alignment: Alignment.centerLeft,
|
|
|
|
|
|
|
|
// decoration: getContainerColor(2),
|
|
|
|
|
|
|
|
// child: Center(
|
|
|
|
|
|
|
|
// child: Text(
|
|
|
|
|
|
|
|
// widget.question.questionOptions![2].titleEn!,
|
|
|
|
|
|
|
|
// style: TextStyle(
|
|
|
|
|
|
|
|
// color: isSelectedOptions[2] ? MyColors.white : MyColors.darkTextColor,
|
|
|
|
|
|
|
|
// fontWeight: FontWeight.w600,
|
|
|
|
|
|
|
|
// fontSize: 16,
|
|
|
|
|
|
|
|
// ),
|
|
|
|
|
|
|
|
// ).paddingOnly(top: 17, bottom: 17),
|
|
|
|
|
|
|
|
// ),
|
|
|
|
|
|
|
|
// ),
|
|
|
|
|
|
|
|
// ),
|
|
|
|
|
|
|
|
// const SizedBox(height: 15),
|
|
|
|
|
|
|
|
// InkWell(
|
|
|
|
|
|
|
|
// onTap: () {
|
|
|
|
|
|
|
|
// if (widget.provider.currentQuestionNumber == 9) {
|
|
|
|
|
|
|
|
// widget.provider.cancelTimer();
|
|
|
|
|
|
|
|
// widget.provider.resetValues();
|
|
|
|
|
|
|
|
// Navigator.pushReplacementNamed(
|
|
|
|
|
|
|
|
// context,
|
|
|
|
|
|
|
|
// AppRoutes.marathonWinnerSelection,
|
|
|
|
|
|
|
|
// );
|
|
|
|
|
|
|
|
// return;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// updateOption(3, true);
|
|
|
|
|
|
|
|
// },
|
|
|
|
|
|
|
|
// child: Container(
|
|
|
|
|
|
|
|
// alignment: Alignment.centerLeft,
|
|
|
|
|
|
|
|
// decoration: getContainerColor(3),
|
|
|
|
|
|
|
|
// child: Center(
|
|
|
|
|
|
|
|
// child: Text(
|
|
|
|
|
|
|
|
// widget.question.questionOptions![3].titleEn!,
|
|
|
|
|
|
|
|
// style: TextStyle(
|
|
|
|
|
|
|
|
// color: isSelectedOptions[3] ? MyColors.white : MyColors.darkTextColor,
|
|
|
|
|
|
|
|
// fontWeight: FontWeight.w600,
|
|
|
|
|
|
|
|
// fontSize: 16,
|
|
|
|
|
|
|
|
// ),
|
|
|
|
|
|
|
|
// ).paddingOnly(top: 17, bottom: 17),
|
|
|
|
|
|
|
|
// ),
|
|
|
|
|
|
|
|
// ),
|
|
|
|
|
|
|
|
// ),
|
|
|
|
|
|
|
|
|