Perbarui struktur dan referensi file di dashboard_view.dart dan detail_donatur_view.dart. Tambahkan dokumentasi pada kelas DateTimeHelper dan perkenalan fungsi baru untuk format tanggal relatif serta nama hari dan bulan. Hapus widget yang tidak digunakan seperti detail_penitipan_dialog.dart, loading_indicator.dart, navigation_button.dart, statistic_card.dart, dan status_pill.dart untuk menyederhanakan kode.

This commit is contained in:
Khafidh Fuadi
2025-03-16 16:30:23 +07:00
parent 5814b19546
commit 078d74aad3
22 changed files with 1639 additions and 509 deletions

View File

@ -0,0 +1,103 @@
import 'package:flutter/material.dart';
import 'package:penyaluran_app/app/theme/app_theme.dart';
/// Indikator status berbentuk pill yang digunakan untuk menampilkan status
///
/// Indikator ini memiliki teks status dan warna latar belakang yang dapat
/// dikonfigurasi.
class StatusPill extends StatelessWidget {
/// Teks status yang ditampilkan
final String status;
/// Warna latar belakang pill
final Color? backgroundColor;
/// Gaya teks status
final TextStyle? textStyle;
/// Warna teks status
final Color? textColor;
/// Padding pill
final EdgeInsetsGeometry padding;
/// Radius border pill
final double borderRadius;
/// Konstruktor untuk StatusPill
const StatusPill({
super.key,
required this.status,
this.backgroundColor,
this.textStyle,
this.textColor,
this.padding = const EdgeInsets.symmetric(horizontal: 10, vertical: 4),
this.borderRadius = 12,
});
/// Konstruktor factory untuk StatusPill dengan status "Terverifikasi"
factory StatusPill.verified({String status = 'Terverifikasi'}) {
return StatusPill(
status: status,
backgroundColor: AppTheme.verifiedColor,
textColor: Colors.white,
);
}
/// Konstruktor factory untuk StatusPill dengan status "Diproses"
factory StatusPill.processed({String status = 'Diproses'}) {
return StatusPill(
status: status,
backgroundColor: AppTheme.processedColor,
textColor: Colors.white,
);
}
/// Konstruktor factory untuk StatusPill dengan status "Ditolak"
factory StatusPill.rejected({String status = 'Ditolak'}) {
return StatusPill(
status: status,
backgroundColor: AppTheme.rejectedColor,
textColor: Colors.white,
);
}
/// Konstruktor factory untuk StatusPill dengan status "Dijadwalkan"
factory StatusPill.scheduled({String status = 'Dijadwalkan'}) {
return StatusPill(
status: status,
backgroundColor: AppTheme.scheduledColor,
textColor: Colors.white,
);
}
/// Konstruktor factory untuk StatusPill dengan status "Selesai"
factory StatusPill.completed({String status = 'Selesai'}) {
return StatusPill(
status: status,
backgroundColor: AppTheme.completedColor,
textColor: Colors.white,
);
}
@override
Widget build(BuildContext context) {
final textTheme = Theme.of(context).textTheme;
return Container(
padding: padding,
decoration: BoxDecoration(
color: backgroundColor ?? AppTheme.verifiedColor,
borderRadius: BorderRadius.circular(borderRadius),
),
child: Text(
status,
style: textStyle ??
textTheme.bodySmall?.copyWith(
fontSize: 10,
color: textColor ?? Colors.white,
),
),
);
}
}