105 lines
3.4 KiB
Dart
105 lines
3.4 KiB
Dart
// lib/features/academic/widgets/academic_subject_card.dart
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:smpn1_lengkong/core/constants/app_colors.dart';
|
|
import 'package:smpn1_lengkong/core/models/academic_score_model.dart';
|
|
import 'package:smpn1_lengkong/core/routes/app_routes.dart';
|
|
|
|
class AcademicSubjectCard extends StatelessWidget {
|
|
final AcademicScore scoreData;
|
|
const AcademicSubjectCard({super.key, required this.scoreData});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final double avg = scoreData.averageMapel;
|
|
final bool isGood = avg >= 75;
|
|
|
|
return GestureDetector(
|
|
onTap: () {
|
|
// Navigasi ke halaman detail baru untuk tampilan yang lebih lega dan estetik
|
|
Navigator.pushNamed(
|
|
context,
|
|
AppRoutes.academicDetail,
|
|
arguments: scoreData,
|
|
);
|
|
},
|
|
child: Container(
|
|
margin: EdgeInsets.only(bottom: 16.h),
|
|
padding: EdgeInsets.all(20.w),
|
|
decoration: BoxDecoration(
|
|
color: Colors.white,
|
|
borderRadius: BorderRadius.circular(16.r),
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: Colors.black.withOpacity(0.02),
|
|
blurRadius: 10,
|
|
offset: const Offset(0, 4),
|
|
),
|
|
],
|
|
border: Border.all(color: Colors.grey.shade100),
|
|
),
|
|
child: Row(
|
|
children: [
|
|
// Icon Indikator Mata Pelajaran
|
|
Container(
|
|
padding: EdgeInsets.all(12.w),
|
|
decoration: BoxDecoration(
|
|
color: AppColors.primaryBlue.withOpacity(0.05),
|
|
borderRadius: BorderRadius.circular(12.r),
|
|
),
|
|
child: Icon(
|
|
Icons.menu_book_rounded,
|
|
color: AppColors.primaryBlue,
|
|
size: 22.sp,
|
|
),
|
|
),
|
|
SizedBox(width: 16.w),
|
|
// Nama Mapel dan Status Ketuntasan
|
|
Expanded(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
scoreData.subject,
|
|
style: TextStyle(
|
|
fontWeight: FontWeight.bold,
|
|
fontSize: 15.sp,
|
|
color: AppColors.textPrimary,
|
|
),
|
|
),
|
|
SizedBox(height: 4.h),
|
|
Text(
|
|
isGood ? "Tuntas" : "Belum Tuntas",
|
|
style: TextStyle(
|
|
color:
|
|
isGood ? AppColors.successGreen : AppColors.dangerRed,
|
|
fontSize: 12.sp,
|
|
fontWeight: FontWeight.w500,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
// Nilai Rata-rata yang tampil di Card Utama
|
|
Text(
|
|
avg % 1 == 0 ? avg.toInt().toString() : avg.toStringAsFixed(1),
|
|
style: TextStyle(
|
|
fontSize: 18.sp,
|
|
fontWeight: FontWeight.w800,
|
|
color: AppColors.textPrimary,
|
|
),
|
|
),
|
|
SizedBox(width: 4.w),
|
|
Icon(
|
|
Icons.chevron_right_rounded,
|
|
size: 20.sp,
|
|
color: Colors.grey[300],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|