fix: info not showing
This commit is contained in:
parent
668c7eac27
commit
9df43d451e
|
@ -4,8 +4,13 @@ import 'package:quiz_app/data/models/quiz/quiz_listing_model.dart';
|
||||||
|
|
||||||
class QuizContainerComponent extends StatelessWidget {
|
class QuizContainerComponent extends StatelessWidget {
|
||||||
final QuizListingModel data;
|
final QuizListingModel data;
|
||||||
final Function(String) onTap;
|
final void Function(String quizId) onTap;
|
||||||
const QuizContainerComponent({required this.data, required this.onTap, super.key});
|
|
||||||
|
const QuizContainerComponent({
|
||||||
|
required this.data,
|
||||||
|
required this.onTap,
|
||||||
|
super.key,
|
||||||
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -16,75 +21,78 @@ class QuizContainerComponent extends StatelessWidget {
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: AppColors.background,
|
color: AppColors.background,
|
||||||
borderRadius: BorderRadius.circular(12),
|
borderRadius: BorderRadius.circular(12),
|
||||||
border: Border.all(
|
border: Border.all(color: const Color(0xFFE1E4E8)),
|
||||||
color: Color(0xFFE1E4E8),
|
|
||||||
),
|
|
||||||
boxShadow: [
|
boxShadow: [
|
||||||
BoxShadow(
|
BoxShadow(
|
||||||
color: Colors.black.withOpacity(0.03),
|
color: Colors.black.withOpacity(0.03),
|
||||||
blurRadius: 8,
|
blurRadius: 8,
|
||||||
offset: Offset(0, 2),
|
offset: const Offset(0, 2),
|
||||||
)
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Container(
|
_buildIconBox(),
|
||||||
width: 50,
|
|
||||||
height: 50,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Color(0xFF0052CC),
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
|
||||||
child: const Icon(Icons.school, color: Colors.white, size: 28),
|
|
||||||
),
|
|
||||||
const SizedBox(width: 12),
|
const SizedBox(width: 12),
|
||||||
// Quiz Info
|
Expanded(child: _buildQuizInfo()),
|
||||||
Expanded(
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
data.title,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 16,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
color: Color(0xFF172B4D),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 4),
|
|
||||||
Text(
|
|
||||||
"created by ${data.authorName}",
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 12,
|
|
||||||
color: Color(0xFF6B778C),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 8),
|
|
||||||
Row(
|
|
||||||
children: const [
|
|
||||||
Icon(Icons.format_list_bulleted, size: 14, color: Color(0xFF6B778C)),
|
|
||||||
SizedBox(width: 4),
|
|
||||||
Text(
|
|
||||||
"50 Quizzes",
|
|
||||||
style: TextStyle(fontSize: 12, color: Color(0xFF6B778C)),
|
|
||||||
),
|
|
||||||
SizedBox(width: 12),
|
|
||||||
Icon(Icons.access_time, size: 14, color: Color(0xFF6B778C)),
|
|
||||||
SizedBox(width: 4),
|
|
||||||
Text(
|
|
||||||
"1 hr duration",
|
|
||||||
style: TextStyle(fontSize: 12, color: Color(0xFF6B778C)),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget _buildIconBox() {
|
||||||
|
return Container(
|
||||||
|
width: 50,
|
||||||
|
height: 50,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: const Color(0xFF0052CC),
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
),
|
||||||
|
child: const Icon(Icons.school, color: Colors.white, size: 28),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildQuizInfo() {
|
||||||
|
return Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
data.title,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: Color(0xFF172B4D),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 4),
|
||||||
|
Text(
|
||||||
|
'Created by ${data.authorName}',
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
color: Color(0xFF6B778C),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
const Icon(Icons.format_list_bulleted, size: 14, color: Color(0xFF6B778C)),
|
||||||
|
const SizedBox(width: 4),
|
||||||
|
Text(
|
||||||
|
'${data.totalQuiz} Quizzes',
|
||||||
|
style: const TextStyle(fontSize: 12, color: Color(0xFF6B778C)),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 12),
|
||||||
|
const Icon(Icons.access_time, size: 14, color: Color(0xFF6B778C)),
|
||||||
|
const SizedBox(width: 4),
|
||||||
|
Text(
|
||||||
|
'${data.duration} menit',
|
||||||
|
style: const TextStyle(fontSize: 12, color: Color(0xFF6B778C)),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,8 @@ class QuizListingModel {
|
||||||
final String title;
|
final String title;
|
||||||
final String description;
|
final String description;
|
||||||
final String date;
|
final String date;
|
||||||
|
final int totalQuiz;
|
||||||
|
final int duration;
|
||||||
|
|
||||||
QuizListingModel({
|
QuizListingModel({
|
||||||
required this.quizId,
|
required this.quizId,
|
||||||
|
@ -13,6 +15,8 @@ class QuizListingModel {
|
||||||
required this.title,
|
required this.title,
|
||||||
required this.description,
|
required this.description,
|
||||||
required this.date,
|
required this.date,
|
||||||
|
required this.duration,
|
||||||
|
required this.totalQuiz,
|
||||||
});
|
});
|
||||||
|
|
||||||
factory QuizListingModel.fromJson(Map<String, dynamic> json) {
|
factory QuizListingModel.fromJson(Map<String, dynamic> json) {
|
||||||
|
@ -23,6 +27,8 @@ class QuizListingModel {
|
||||||
title: json['title'] as String,
|
title: json['title'] as String,
|
||||||
description: json['description'] as String,
|
description: json['description'] as String,
|
||||||
date: json['date'] as String,
|
date: json['date'] as String,
|
||||||
|
duration: json['duration'] as int,
|
||||||
|
totalQuiz: json["total_quiz"] as int,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,6 +40,8 @@ class QuizListingModel {
|
||||||
'title': title,
|
'title': title,
|
||||||
'description': description,
|
'description': description,
|
||||||
'date': date,
|
'date': date,
|
||||||
|
'duration': duration,
|
||||||
|
"total_quiz": totalQuiz
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue