Complete Socratic adaptive exams in Flutter, Guardian WhatsApp alerts, and curriculum robustness
This commit is contained in:
@@ -6,6 +6,7 @@ import '../../../core/utils/saqel_toast.dart';
|
||||
import '../../../data/models/subject_model.dart';
|
||||
import '../../widgets/luxury_widgets.dart';
|
||||
import '../player/socratic_video_player_screen.dart';
|
||||
import '../exams/adaptive_exam_screen.dart';
|
||||
|
||||
class SubjectHubScreen extends StatefulWidget {
|
||||
final SubjectModel subject;
|
||||
@@ -250,7 +251,7 @@ class _SubjectHubScreenState extends State<SubjectHubScreen> with SingleTickerPr
|
||||
IconButton(
|
||||
icon: const Icon(CupertinoIcons.arrow_down_circle_fill, color: AppColors.saqelCyan, size: 28),
|
||||
onPressed: () {
|
||||
SaqelToast.showSuccess(context, 'تم تجهيز ملف ${ws.title} للتحميل', title: 'تحميل المذكرة 📄');
|
||||
_showResourceSheet(context, ws.title, 'ورقة عمل ومذكرة مراجعة', 'PDF جاهز للطباعة بدقة عالية');
|
||||
},
|
||||
),
|
||||
],
|
||||
@@ -323,7 +324,15 @@ class _SubjectHubScreenState extends State<SubjectHubScreen> with SingleTickerPr
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
|
||||
),
|
||||
onPressed: () {
|
||||
SaqelToast.showInfo(context, 'جاري توليد أسئلة الاختبار التكيفي من بنك الوزارة', title: 'بدء الامتحان 📝');
|
||||
Navigator.of(context).push(
|
||||
CupertinoPageRoute(
|
||||
builder: (context) => AdaptiveExamScreen(
|
||||
examId: idx + 1,
|
||||
title: exam.title,
|
||||
subjectTitle: widget.subject.title,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
child: const Text('بدء الاختبار 🚀', style: TextStyle(fontSize: 12, fontWeight: FontWeight.w700)),
|
||||
),
|
||||
@@ -385,7 +394,7 @@ class _SubjectHubScreenState extends State<SubjectHubScreen> with SingleTickerPr
|
||||
IconButton(
|
||||
icon: const Icon(CupertinoIcons.eye_fill, color: AppColors.saqelCyan, size: 24),
|
||||
onPressed: () {
|
||||
SaqelToast.showInfo(context, 'جاري فتح ${tb.title} عبر عارض الكتب الذكي', title: 'الكتاب الوزاري 📚');
|
||||
_showResourceSheet(context, tb.title, 'الكتاب المدرسي المعتمد', 'نسخة وزارة التربية والتعليم المنقحة والمحدثة');
|
||||
},
|
||||
),
|
||||
],
|
||||
@@ -395,4 +404,97 @@ class _SubjectHubScreenState extends State<SubjectHubScreen> with SingleTickerPr
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
void _showResourceSheet(BuildContext context, String title, String subtitle, String description) {
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
backgroundColor: AppColors.darkSurface,
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.vertical(top: Radius.circular(24)),
|
||||
),
|
||||
builder: (ctx) => SafeArea(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(24),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.appleBlue.withAlpha(30),
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
),
|
||||
child: const Icon(CupertinoIcons.doc_text_fill, color: AppColors.saqelCyan, size: 26),
|
||||
),
|
||||
const SizedBox(width: 14),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
title,
|
||||
style: const TextStyle(color: Colors.white, fontWeight: FontWeight.w800, fontSize: 16),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
subtitle,
|
||||
style: const TextStyle(color: AppColors.saqelCyan, fontSize: 12, fontWeight: FontWeight.w600),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
description,
|
||||
style: const TextStyle(color: AppColors.textSecondaryDark, fontSize: 13.5),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: OutlinedButton.icon(
|
||||
style: OutlinedButton.styleFrom(
|
||||
foregroundColor: Colors.white,
|
||||
side: const BorderSide(color: AppColors.darkCardBorder),
|
||||
padding: const EdgeInsets.symmetric(vertical: 14),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.of(ctx).pop();
|
||||
SaqelToast.showSuccess(context, 'تم تفعيل وضع القراءة دون إنترنت 📖', title: 'حفظ محلي');
|
||||
},
|
||||
icon: const Icon(CupertinoIcons.cloud_download, size: 18),
|
||||
label: const Text('حفظ في الجهاز', style: TextStyle(fontWeight: FontWeight.w700)),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: ElevatedButton.icon(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: AppColors.appleBlue,
|
||||
foregroundColor: Colors.white,
|
||||
padding: const EdgeInsets.symmetric(vertical: 14),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.of(ctx).pop();
|
||||
SaqelToast.showInfo(context, 'جاري عرض محتوى $title بالكامل عبر عارض الكتب الذكي', title: 'فتح الوثيقة 📑');
|
||||
},
|
||||
icon: const Icon(CupertinoIcons.book, size: 18),
|
||||
label: const Text('قراءة وتصفح', style: TextStyle(fontWeight: FontWeight.w800)),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,573 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import '../../../core/theme/app_colors.dart';
|
||||
import '../../../core/theme/app_theme.dart';
|
||||
import '../../../core/utils/saqel_toast.dart';
|
||||
import '../../../data/models/exam_model.dart';
|
||||
import '../../../logic/cubits/exam_cubit.dart';
|
||||
import '../../widgets/luxury_widgets.dart';
|
||||
|
||||
class AdaptiveExamScreen extends StatelessWidget {
|
||||
final int examId;
|
||||
final String title;
|
||||
final String? subjectTitle;
|
||||
|
||||
const AdaptiveExamScreen({
|
||||
super.key,
|
||||
required this.examId,
|
||||
required this.title,
|
||||
this.subjectTitle,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocProvider(
|
||||
create: (context) => ExamCubit()..loadExam(examId: examId),
|
||||
child: _AdaptiveExamView(title: title, subjectTitle: subjectTitle),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _AdaptiveExamView extends StatelessWidget {
|
||||
final String title;
|
||||
final String? subjectTitle;
|
||||
|
||||
const _AdaptiveExamView({required this.title, this.subjectTitle});
|
||||
|
||||
String _formatTimer(int seconds) {
|
||||
final m = seconds ~/ 60;
|
||||
final s = seconds % 60;
|
||||
return '${m.toString().padLeft(2, '0')}:${s.toString().padLeft(2, '0')}';
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.darkBackground,
|
||||
appBar: AppBar(
|
||||
backgroundColor: AppColors.darkSurface,
|
||||
elevation: 0,
|
||||
leading: IconButton(
|
||||
icon: const Icon(CupertinoIcons.xmark, color: Colors.white),
|
||||
onPressed: () => _confirmExit(context),
|
||||
),
|
||||
title: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
title,
|
||||
style: AppTypography.titleLarge.copyWith(color: Colors.white, fontSize: 16),
|
||||
),
|
||||
if (subjectTitle != null)
|
||||
Text(
|
||||
subjectTitle!,
|
||||
style: const TextStyle(color: AppColors.saqelCyan, fontSize: 11, fontWeight: FontWeight.w600),
|
||||
),
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
BlocBuilder<ExamCubit, ExamState>(
|
||||
builder: (context, state) {
|
||||
if (state is ExamLoaded) {
|
||||
final isUrgent = state.remainingSeconds < 120;
|
||||
return Center(
|
||||
child: Container(
|
||||
margin: const EdgeInsets.only(left: 16),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
|
||||
decoration: BoxDecoration(
|
||||
color: isUrgent ? AppColors.crimsonRed.withAlpha(40) : AppColors.appleBlue.withAlpha(30),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
border: Border.all(
|
||||
color: isUrgent ? AppColors.crimsonRed : AppColors.appleBlue.withAlpha(100),
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(
|
||||
CupertinoIcons.time,
|
||||
size: 14,
|
||||
color: isUrgent ? AppColors.crimsonRed : AppColors.saqelCyan,
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
_formatTimer(state.remainingSeconds),
|
||||
style: TextStyle(
|
||||
color: isUrgent ? AppColors.crimsonRed : Colors.white,
|
||||
fontWeight: FontWeight.w800,
|
||||
fontSize: 13,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
return const SizedBox.shrink();
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
body: BlocConsumer<ExamCubit, ExamState>(
|
||||
listener: (context, state) {
|
||||
if (state is ExamError) {
|
||||
SaqelToast.showError(context, state.message, title: 'تنبيه ⚠️');
|
||||
}
|
||||
},
|
||||
builder: (context, state) {
|
||||
if (state is ExamLoading) {
|
||||
return Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const CupertinoActivityIndicator(radius: 18, color: AppColors.saqelCyan),
|
||||
const SizedBox(height: 18),
|
||||
Text(
|
||||
state.message,
|
||||
style: const TextStyle(color: AppColors.textSecondaryDark, fontSize: 14),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
} else if (state is ExamCompleted) {
|
||||
return _buildResultView(context, state);
|
||||
} else if (state is ExamLoaded) {
|
||||
return _buildActiveExamView(context, state);
|
||||
}
|
||||
return const Center(
|
||||
child: Text(
|
||||
'لا تتوفر بيانات للاختبار الحالي',
|
||||
style: TextStyle(color: AppColors.textSecondaryDark),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _confirmExit(BuildContext context) {
|
||||
final state = context.read<ExamCubit>().state;
|
||||
if (state is ExamCompleted) {
|
||||
Navigator.of(context).pop();
|
||||
return;
|
||||
}
|
||||
|
||||
showCupertinoDialog(
|
||||
context: context,
|
||||
builder: (ctx) => CupertinoAlertDialog(
|
||||
title: const Text('مغادرة الاختبار؟', style: TextStyle(fontWeight: FontWeight.bold)),
|
||||
content: const Text('هل أنت متأكد من رغبتك بالخروج؟ سيتم حفظ الأسئلة التي قمت بحلها فقط.'),
|
||||
actions: [
|
||||
CupertinoDialogAction(
|
||||
isDefaultAction: true,
|
||||
onPressed: () => Navigator.of(ctx).pop(),
|
||||
child: const Text('متابعة الاختبار'),
|
||||
),
|
||||
CupertinoDialogAction(
|
||||
isDestructiveAction: true,
|
||||
onPressed: () {
|
||||
Navigator.of(ctx).pop();
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: const Text('خروج'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// Active Question & Options Layout
|
||||
Widget _buildActiveExamView(BuildContext context, ExamLoaded state) {
|
||||
final question = state.currentQuestion;
|
||||
if (question == null) return const SizedBox.shrink();
|
||||
|
||||
final totalQuestions = state.exam.questions.length;
|
||||
final progress = (state.currentQuestionIndex + 1) / totalQuestions;
|
||||
final selectedOptionId = state.selectedAnswers[question.id];
|
||||
|
||||
return Column(
|
||||
children: [
|
||||
// Progress Bar
|
||||
LinearProgressIndicator(
|
||||
value: progress,
|
||||
backgroundColor: AppColors.darkCardBorder,
|
||||
valueColor: const AlwaysStoppedAnimation<Color>(AppColors.saqelCyan),
|
||||
minHeight: 4,
|
||||
),
|
||||
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 20),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// Question Header Pill
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.appleBlue.withAlpha(30),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Text(
|
||||
'السؤال ${state.currentQuestionIndex + 1} من $totalQuestions',
|
||||
style: const TextStyle(
|
||||
color: AppColors.saqelCyan,
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.darkCardBorder,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Text(
|
||||
'${question.points} درجات',
|
||||
style: const TextStyle(
|
||||
color: AppColors.textSecondaryDark,
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
const SizedBox(height: 12),
|
||||
|
||||
// Topic Tag Pill
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.amberGold.withAlpha(25),
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
child: Text(
|
||||
'🎯 المفهوم: ${question.topicTag}',
|
||||
style: const TextStyle(
|
||||
color: AppColors.amberGold,
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 11.5,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// Question Text
|
||||
Text(
|
||||
question.questionText,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 16.5,
|
||||
height: 1.5,
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// Options List
|
||||
...question.options.map((opt) {
|
||||
final isSelected = selectedOptionId == opt.id;
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: 12),
|
||||
child: InkWell(
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
onTap: () {
|
||||
context.read<ExamCubit>().selectOption(question.id, opt.id);
|
||||
},
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 16),
|
||||
decoration: BoxDecoration(
|
||||
color: isSelected ? AppColors.appleBlue.withAlpha(40) : AppColors.darkSurface,
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
border: Border.all(
|
||||
color: isSelected ? AppColors.saqelCyan : AppColors.darkCardBorder,
|
||||
width: isSelected ? 1.8 : 1,
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 24,
|
||||
height: 24,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: isSelected ? AppColors.saqelCyan : Colors.transparent,
|
||||
border: Border.all(
|
||||
color: isSelected ? AppColors.saqelCyan : AppColors.textSecondaryDark,
|
||||
width: 2,
|
||||
),
|
||||
),
|
||||
child: isSelected
|
||||
? const Icon(CupertinoIcons.checkmark, size: 14, color: Colors.black)
|
||||
: null,
|
||||
),
|
||||
const SizedBox(width: 14),
|
||||
Expanded(
|
||||
child: Text(
|
||||
opt.optionText,
|
||||
style: TextStyle(
|
||||
color: isSelected ? Colors.white : AppColors.textPrimaryDark,
|
||||
fontWeight: isSelected ? FontWeight.w700 : FontWeight.w500,
|
||||
fontSize: 14.5,
|
||||
height: 1.4,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
// Navigation Footer
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 14),
|
||||
decoration: const BoxDecoration(
|
||||
color: AppColors.darkSurface,
|
||||
border: Border(
|
||||
top: BorderSide(color: AppColors.darkCardBorder),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
if (state.currentQuestionIndex > 0)
|
||||
OutlinedButton(
|
||||
style: OutlinedButton.styleFrom(
|
||||
foregroundColor: Colors.white,
|
||||
side: const BorderSide(color: AppColors.darkCardBorder),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 18, vertical: 12),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
||||
),
|
||||
onPressed: () => context.read<ExamCubit>().previousQuestion(),
|
||||
child: const Text('السابق', style: TextStyle(fontWeight: FontWeight.w700)),
|
||||
)
|
||||
else
|
||||
const SizedBox.shrink(),
|
||||
|
||||
ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: state.isLastQuestion ? AppColors.emeraldGreen : AppColors.appleBlue,
|
||||
foregroundColor: Colors.white,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 26, vertical: 14),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
||||
elevation: 0,
|
||||
),
|
||||
onPressed: state.isSubmitting
|
||||
? null
|
||||
: () {
|
||||
if (state.isLastQuestion) {
|
||||
context.read<ExamCubit>().submitCurrentExam();
|
||||
} else {
|
||||
context.read<ExamCubit>().nextQuestion();
|
||||
}
|
||||
},
|
||||
child: state.isSubmitting
|
||||
? const CupertinoActivityIndicator(color: Colors.white)
|
||||
: Text(
|
||||
state.isLastQuestion ? 'إنهاء وتسليم الاختبار 🎯' : 'السؤال التالي ⬅️',
|
||||
style: const TextStyle(fontWeight: FontWeight.w800, fontSize: 14),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
/// AI Diagnostic Result View
|
||||
Widget _buildResultView(BuildContext context, ExamCompleted state) {
|
||||
final res = state.result;
|
||||
final isPassed = res.passed;
|
||||
|
||||
return SingleChildScrollView(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 24),
|
||||
child: Column(
|
||||
children: [
|
||||
// Status Card
|
||||
Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(24),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: isPassed
|
||||
? [const Color(0xFF0F382A), AppColors.darkSurface]
|
||||
: [const Color(0xFF3B151A), AppColors.darkSurface],
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
border: Border.all(
|
||||
color: isPassed ? AppColors.emeraldGreen.withAlpha(120) : AppColors.crimsonRed.withAlpha(120),
|
||||
width: 1.2,
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Icon(
|
||||
isPassed ? CupertinoIcons.checkmark_seal_fill : CupertinoIcons.lightbulb_fill,
|
||||
size: 58,
|
||||
color: isPassed ? AppColors.emeraldGreen : AppColors.amberGold,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Text(
|
||||
isPassed ? 'تم اجتياز الاختبار بنجاح واقتدار! 🎓' : 'تحتاج إلى تعزيز المفاهيم ومراجعة الثغرات 💡',
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.w800,
|
||||
fontSize: 18,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// Score Badge
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.black.withAlpha(120),
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
'${res.percentage.toStringAsFixed(1)}%',
|
||||
style: TextStyle(
|
||||
color: isPassed ? AppColors.emeraldGreen : AppColors.amberGold,
|
||||
fontWeight: FontWeight.w900,
|
||||
fontSize: 28,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'الدرجة: ${res.score} / ${res.totalScore}',
|
||||
style: const TextStyle(color: Colors.white, fontWeight: FontWeight.w700, fontSize: 13),
|
||||
),
|
||||
Text(
|
||||
'مؤشر الجاهزية: ${res.tawjihiReadinessScore.toStringAsFixed(1)}%',
|
||||
style: const TextStyle(color: AppColors.saqelCyan, fontSize: 11.5),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 20),
|
||||
|
||||
// Socratic Diagnostic Report
|
||||
LuxuryCard(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Row(
|
||||
children: [
|
||||
Icon(CupertinoIcons.sparkles, color: AppColors.saqelCyan, size: 20),
|
||||
SizedBox(width: 8),
|
||||
Text(
|
||||
'التقرير التشخيصي الذكي (AI Socratic Report)',
|
||||
style: TextStyle(color: Colors.white, fontWeight: FontWeight.w800, fontSize: 14.5),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Text(
|
||||
res.aiDiagnosticReport,
|
||||
style: const TextStyle(
|
||||
color: AppColors.textPrimaryDark,
|
||||
fontSize: 13.5,
|
||||
height: 1.55,
|
||||
),
|
||||
),
|
||||
if (res.weakTopics.isNotEmpty) ...[
|
||||
const SizedBox(height: 16),
|
||||
const Text(
|
||||
'المفاهيم المقترح مراجعتها لسد الثغرات:',
|
||||
style: TextStyle(color: AppColors.amberGold, fontWeight: FontWeight.w700, fontSize: 12.5),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Wrap(
|
||||
spacing: 8,
|
||||
runSpacing: 8,
|
||||
children: res.weakTopics.map((topic) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.crimsonRed.withAlpha(25),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(color: AppColors.crimsonRed.withAlpha(60)),
|
||||
),
|
||||
child: Text(
|
||||
'📌 $topic',
|
||||
style: const TextStyle(color: AppColors.crimsonRed, fontSize: 12, fontWeight: FontWeight.w700),
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// Action Buttons
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: OutlinedButton(
|
||||
style: OutlinedButton.styleFrom(
|
||||
foregroundColor: Colors.white,
|
||||
side: const BorderSide(color: AppColors.darkCardBorder),
|
||||
padding: const EdgeInsets.symmetric(vertical: 14),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
||||
),
|
||||
onPressed: () {
|
||||
context.read<ExamCubit>().loadExam(examId: state.exam.id, initialExam: state.exam);
|
||||
},
|
||||
child: const Text('إعادة المحاولة 🔄', style: TextStyle(fontWeight: FontWeight.w700)),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 14),
|
||||
Expanded(
|
||||
child: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: AppColors.appleBlue,
|
||||
foregroundColor: Colors.white,
|
||||
padding: const EdgeInsets.symmetric(vertical: 14),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
||||
),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: const Text('العودة للدروس 📚', style: TextStyle(fontWeight: FontWeight.w800)),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user