
- Hapus file petugas_desa_dashboard_view.dart - Perbarui app_pages.dart untuk menggunakan PetugasDesaView dan PetugasDesaBinding - Pindahkan logika dashboard ke modul petugas_desa yang baru - Sesuaikan routing untuk dashboard Petugas Desa
134 lines
4.0 KiB
Dart
134 lines
4.0 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:penyaluran_app/app/theme/app_theme.dart';
|
|
|
|
class ProgressSection extends StatelessWidget {
|
|
final double progressValue;
|
|
final int total;
|
|
final int distributed;
|
|
final int scheduled;
|
|
final int unscheduled;
|
|
|
|
const ProgressSection({
|
|
super.key,
|
|
required this.progressValue,
|
|
required this.total,
|
|
required this.distributed,
|
|
required this.scheduled,
|
|
required this.unscheduled,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final textTheme = Theme.of(context).textTheme;
|
|
|
|
return Container(
|
|
width: double.infinity,
|
|
padding: const EdgeInsets.all(12),
|
|
decoration: BoxDecoration(
|
|
gradient: AppTheme.primaryGradient,
|
|
borderRadius: BorderRadius.circular(12),
|
|
),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
'Progress Penyaluran',
|
|
style: textTheme.titleMedium?.copyWith(
|
|
fontSize: 16,
|
|
fontWeight: FontWeight.bold,
|
|
color: Colors.white,
|
|
),
|
|
),
|
|
const SizedBox(height: 10),
|
|
ClipRRect(
|
|
borderRadius: BorderRadius.circular(8),
|
|
child: LinearProgressIndicator(
|
|
value: progressValue,
|
|
minHeight: 10,
|
|
backgroundColor: Colors.white.withOpacity(0.3),
|
|
valueColor: const AlwaysStoppedAnimation<Color>(Colors.white),
|
|
),
|
|
),
|
|
const SizedBox(height: 10),
|
|
Text(
|
|
'${(progressValue * 100).toInt()}% Selesai',
|
|
style: textTheme.bodyMedium?.copyWith(
|
|
fontSize: 14,
|
|
fontWeight: FontWeight.bold,
|
|
color: Colors.white,
|
|
),
|
|
),
|
|
const SizedBox(height: 10),
|
|
_buildProgressDetailRow('Telah Menerima', distributed, textTheme),
|
|
_buildProgressDetailRow('Dijedwalkan', scheduled, textTheme),
|
|
_buildProgressDetailRow('Belum Dijadwalkan', unscheduled, textTheme),
|
|
const SizedBox(height: 5),
|
|
Text(
|
|
'Total : $total Penerima, Telah Disalurkan : $distributed Penerima, Belum Disalurkan : ${total - distributed}',
|
|
style: textTheme.bodySmall?.copyWith(
|
|
fontSize: 12,
|
|
color: Colors.white.withOpacity(0.8),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget _buildProgressDetailRow(String label, int value, TextTheme textTheme) {
|
|
final percentage = total > 0 ? (value / total) : 0.0;
|
|
|
|
return Padding(
|
|
padding: const EdgeInsets.symmetric(vertical: 2),
|
|
child: Row(
|
|
children: [
|
|
Expanded(
|
|
flex: 5,
|
|
child: Text(
|
|
label,
|
|
style: textTheme.bodyMedium?.copyWith(
|
|
fontSize: 14,
|
|
color: Colors.white,
|
|
),
|
|
),
|
|
),
|
|
Expanded(
|
|
flex: 5,
|
|
child: Stack(
|
|
children: [
|
|
Container(
|
|
height: 8,
|
|
decoration: BoxDecoration(
|
|
color: Colors.white.withOpacity(0.3),
|
|
borderRadius: BorderRadius.circular(4),
|
|
),
|
|
),
|
|
Container(
|
|
height: 8,
|
|
width: (MediaQuery.of(Get.context!).size.width - 32) *
|
|
0.5 *
|
|
percentage,
|
|
decoration: BoxDecoration(
|
|
color: Colors.white,
|
|
borderRadius: BorderRadius.circular(4),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
const SizedBox(width: 10),
|
|
Text(
|
|
'$value',
|
|
style: textTheme.bodyMedium?.copyWith(
|
|
fontSize: 14,
|
|
fontWeight: FontWeight.bold,
|
|
color: Colors.white,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|