fix: index restul quiz, translation lang and clean up
This commit is contained in:
parent
655103247e
commit
a7f5f98cf5
|
@ -135,5 +135,9 @@
|
|||
"second": "{} s",
|
||||
"minute": "{} m",
|
||||
"hour": "{} h"
|
||||
}
|
||||
},
|
||||
|
||||
"get_ready": "Get Ready",
|
||||
"quiz_starting_soon" : "Quiz Starting Soon"
|
||||
|
||||
}
|
||||
|
|
|
@ -119,5 +119,8 @@
|
|||
"second": "{} d",
|
||||
"minute": "{} m",
|
||||
"hour": "{} j"
|
||||
}
|
||||
},
|
||||
|
||||
"get_ready": "Bersiaplah",
|
||||
"quiz_starting_soon": "Kuis akan segera dimulai"
|
||||
}
|
||||
|
|
|
@ -121,5 +121,8 @@
|
|||
"second": "{} s",
|
||||
"minute": "{} m",
|
||||
"hour": "{} j"
|
||||
}
|
||||
},
|
||||
|
||||
"get_ready": "Bersedia",
|
||||
"quiz_starting_soon": "Kuiz akan bermula sebentar lagi"
|
||||
}
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
import 'dart:ui';
|
||||
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:quiz_app/core/endpoint/api_endpoint.dart';
|
||||
import 'package:quiz_app/core/utils/logger.dart';
|
||||
|
@ -82,7 +85,8 @@ class QuizService extends GetxService {
|
|||
|
||||
Future<BaseResponseModel<List<QuizListingModel>>?> populerQuiz({int page = 1, int amount = 3}) async {
|
||||
try {
|
||||
final response = await dio.get("${APIEndpoint.quizPopuler}?page=$page&limit=$amount");
|
||||
Locale locale = Localizations.localeOf(Get.context!);
|
||||
final response = await dio.get("${APIEndpoint.quizPopuler}?page=$page&limit=$amount&lang_code=${locale.languageCode}");
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
final parsedResponse = BaseResponseModel<List<QuizListingModel>>.fromJson(
|
||||
|
@ -102,7 +106,8 @@ class QuizService extends GetxService {
|
|||
|
||||
Future<BaseResponseModel<List<QuizListingModel>>?> recommendationQuiz({int page = 1, int amount = 3, String userId = ""}) async {
|
||||
try {
|
||||
final response = await dio.get("${APIEndpoint.quizRecommendation}?page=$page&limit=$amount&user_id$userId");
|
||||
Locale locale = Localizations.localeOf(Get.context!);
|
||||
final response = await dio.get("${APIEndpoint.quizRecommendation}?page=$page&limit=$amount&user_id$userId&lang_code=${locale.languageCode}");
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
final parsedResponse = BaseResponseModel<List<QuizListingModel>>.fromJson(
|
||||
|
|
|
@ -16,11 +16,14 @@ class HistoryView extends GetView<HistoryController> {
|
|||
backgroundColor: AppColors.background,
|
||||
body: SafeArea(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 24),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(context.tr("history_title"), style: AppTextStyles.title.copyWith(fontSize: 24)),
|
||||
Text(
|
||||
context.tr("history_title"),
|
||||
style: AppTextStyles.title.copyWith(fontSize: 24),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
context.tr("history_subtitle"),
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:quiz_app/app/const/text/text_style.dart';
|
||||
import 'package:quiz_app/component/widget/container_skeleton_widget.dart';
|
||||
import 'package:quiz_app/data/models/quiz/quiz_listing_model.dart';
|
||||
import 'package:quiz_app/feature/library/controller/library_controller.dart';
|
||||
import 'package:quiz_app/app/const/colors/app_colors.dart';
|
||||
|
||||
class LibraryView extends GetView<LibraryController> {
|
||||
const LibraryView({super.key});
|
||||
|
@ -11,7 +13,7 @@ class LibraryView extends GetView<LibraryController> {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: const Color(0xFFF9FAFB),
|
||||
backgroundColor: AppColors.background2,
|
||||
body: SafeArea(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 24),
|
||||
|
@ -20,19 +22,12 @@ class LibraryView extends GetView<LibraryController> {
|
|||
children: [
|
||||
Text(
|
||||
context.tr('library_title'),
|
||||
style: const TextStyle(
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 24,
|
||||
),
|
||||
style: AppTextStyles.title.copyWith(fontSize: 24),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
context.tr('library_description'),
|
||||
style: const TextStyle(
|
||||
color: Colors.grey,
|
||||
fontSize: 14,
|
||||
),
|
||||
style: AppTextStyles.subtitle,
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Expanded(
|
||||
|
@ -50,7 +45,7 @@ class LibraryView extends GetView<LibraryController> {
|
|||
return Center(
|
||||
child: Text(
|
||||
context.tr('no_quiz_available'),
|
||||
style: const TextStyle(color: Colors.grey, fontSize: 14),
|
||||
style: AppTextStyles.caption,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@ -79,7 +74,7 @@ class LibraryView extends GetView<LibraryController> {
|
|||
margin: const EdgeInsets.only(bottom: 16),
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
color: AppColors.background,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
|
@ -95,7 +90,7 @@ class LibraryView extends GetView<LibraryController> {
|
|||
width: 48,
|
||||
height: 48,
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFF2563EB),
|
||||
color: AppColors.primaryBlue,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: const Icon(Icons.menu_book_rounded, color: Colors.white),
|
||||
|
@ -107,46 +102,42 @@ class LibraryView extends GetView<LibraryController> {
|
|||
children: [
|
||||
Text(
|
||||
quiz.title,
|
||||
style: const TextStyle(
|
||||
style: AppTextStyles.body.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 16,
|
||||
color: Colors.black,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
quiz.description,
|
||||
style: const TextStyle(
|
||||
color: Colors.grey,
|
||||
fontSize: 12,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
style: AppTextStyles.caption,
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Row(
|
||||
children: [
|
||||
const Icon(Icons.calendar_today_rounded, size: 14, color: Colors.grey),
|
||||
const Icon(Icons.calendar_today_rounded, size: 14, color: AppColors.softGrayText),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
controller.formatDate(quiz.date),
|
||||
style: const TextStyle(fontSize: 12, color: Colors.grey),
|
||||
style: AppTextStyles.dateTime,
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
const Icon(Icons.list, size: 14, color: Colors.grey),
|
||||
const Icon(Icons.list, size: 14, color: AppColors.softGrayText),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
context.tr('quiz_count_named', namedArgs: {'total': quiz.totalQuiz.toString()}),
|
||||
style: const TextStyle(fontSize: 12, color: Colors.grey),
|
||||
style: AppTextStyles.dateTime,
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
const Icon(Icons.access_time, size: 14, color: Colors.grey),
|
||||
const Icon(Icons.access_time, size: 14, color: AppColors.softGrayText),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
controller.formatDuration(quiz.duration),
|
||||
style: const TextStyle(fontSize: 12, color: Colors.grey),
|
||||
style: AppTextStyles.dateTime,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
|
@ -95,7 +95,7 @@ class QuizResultView extends GetView<QuizResultController> {
|
|||
final parsed = _parseAnswer(question, answer.selectedAnswer);
|
||||
|
||||
return QuizItemWAComponent(
|
||||
index: index,
|
||||
index: question.index,
|
||||
isCorrect: answer.isCorrect,
|
||||
question: question.question,
|
||||
targetAnswer: parsed.targetAnswer,
|
||||
|
|
Loading…
Reference in New Issue