feat: adjusting on the quiz option
This commit is contained in:
parent
1e45cc271b
commit
2a93a9a371
|
@ -1,5 +1,5 @@
|
||||||
class APIEndpoint {
|
class APIEndpoint {
|
||||||
static const String baseUrl = "http://192.168.110.43:5000";
|
static const String baseUrl = "http://192.168.1.14:5000";
|
||||||
// static const String baseUrl = "http://103.193.178.121:5000";
|
// static const String baseUrl = "http://103.193.178.121:5000";
|
||||||
static const String api = "$baseUrl/api";
|
static const String api = "$baseUrl/api";
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ import 'package:get/get.dart';
|
||||||
import 'package:quiz_app/app/const/colors/app_colors.dart';
|
import 'package:quiz_app/app/const/colors/app_colors.dart';
|
||||||
import 'package:quiz_app/component/global_text_field.dart';
|
import 'package:quiz_app/component/global_text_field.dart';
|
||||||
import 'package:quiz_app/data/models/quiz/question/option_question_model.dart';
|
import 'package:quiz_app/data/models/quiz/question/option_question_model.dart';
|
||||||
|
import 'package:quiz_app/data/models/quiz/question/true_false_question_model.dart';
|
||||||
import 'package:quiz_app/feature/quiz_play/controller/quiz_play_controller.dart';
|
import 'package:quiz_app/feature/quiz_play/controller/quiz_play_controller.dart';
|
||||||
|
|
||||||
class QuizPlayView extends GetView<QuizPlayController> {
|
class QuizPlayView extends GetView<QuizPlayController> {
|
||||||
|
@ -11,31 +12,35 @@ class QuizPlayView extends GetView<QuizPlayController> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return PopScope(
|
||||||
backgroundColor: const Color(0xFFF9FAFB),
|
canPop: false,
|
||||||
body: SafeArea(
|
child: Scaffold(
|
||||||
child: Padding(
|
backgroundColor: const Color(0xFFF9FAFB),
|
||||||
padding: const EdgeInsets.all(16),
|
body: SafeArea(
|
||||||
child: Obx(() {
|
child: Padding(
|
||||||
if (!controller.isStarting.value) {
|
padding: const EdgeInsets.all(16),
|
||||||
return _buildCountdownScreen(context);
|
child: Obx(() {
|
||||||
}
|
if (!controller.isStarting.value) {
|
||||||
|
return _buildCountdownScreen(context);
|
||||||
|
}
|
||||||
|
|
||||||
return ListView(
|
return ListView(
|
||||||
children: [
|
children: [
|
||||||
_buildCustomAppBar(context),
|
_buildCustomAppBar(context),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
_buildProgressBar(),
|
_buildProgressBar(),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
_buildQuestionIndicator(context),
|
_buildQuestionIndicator(context),
|
||||||
const SizedBox(height: 12),
|
const SizedBox(height: 12),
|
||||||
_buildQuestionText(),
|
_buildQuestionText(),
|
||||||
const SizedBox(height: 30),
|
const SizedBox(height: 30),
|
||||||
Expanded(child: _buildAnswerSection(context)),
|
_buildAnswerSection(context),
|
||||||
_buildNextButton(context),
|
Spacer(),
|
||||||
],
|
_buildNextButton(context),
|
||||||
);
|
],
|
||||||
}),
|
);
|
||||||
|
}),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -305,22 +310,28 @@ class QuizPlayView extends GetView<QuizPlayController> {
|
||||||
final question = controller.currentQuestion;
|
final question = controller.currentQuestion;
|
||||||
|
|
||||||
if (question is OptionQuestion) {
|
if (question is OptionQuestion) {
|
||||||
return AnimatedList(
|
return ConstrainedBox(
|
||||||
initialItemCount: question.options.length,
|
constraints: BoxConstraints(
|
||||||
itemBuilder: (context, index, animation) {
|
minHeight: 100,
|
||||||
return SlideTransition(
|
maxHeight: 300,
|
||||||
position: Tween<Offset>(
|
),
|
||||||
begin: const Offset(1, 0),
|
child: AnimatedList(
|
||||||
end: Offset.zero,
|
initialItemCount: question.options.length,
|
||||||
).animate(CurvedAnimation(
|
itemBuilder: (context, index, animation) {
|
||||||
parent: animation,
|
return SlideTransition(
|
||||||
curve: Interval(index * 0.1, 1.0, curve: Curves.easeOut),
|
position: Tween<Offset>(
|
||||||
)),
|
begin: const Offset(1, 0),
|
||||||
child: _buildOptionButton(question.options[index], index),
|
end: Offset.zero,
|
||||||
);
|
).animate(CurvedAnimation(
|
||||||
},
|
parent: animation,
|
||||||
|
curve: Interval(index * 0.1, 1.0, curve: Curves.easeOut),
|
||||||
|
)),
|
||||||
|
child: _buildOptionButton(question.options[index], index),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
} else if (question.type == 'true_false') {
|
} else if (question is TrueFalseQuestion) {
|
||||||
return Column(
|
return Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
|
|
Loading…
Reference in New Issue