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

@ -1,17 +1,39 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:penyaluran_app/app/theme/app_theme.dart';
import 'package:penyaluran_app/app/theme/app_colors.dart';
/// AppBar kustom yang digunakan di seluruh aplikasi
///
/// AppBar ini dapat dikonfigurasi untuk berbagai tampilan dan fungsi.
class CustomAppBar extends StatelessWidget implements PreferredSizeWidget {
/// Judul yang ditampilkan di AppBar
final String title;
/// Apakah menampilkan tombol kembali
final bool showBackButton;
/// Daftar aksi yang ditampilkan di sebelah kanan AppBar
final List<Widget>? actions;
/// Widget yang ditampilkan di sebelah kiri AppBar
final Widget? leading;
/// Apakah judul berada di tengah
final bool centerTitle;
/// Elevasi AppBar
final double elevation;
/// Warna latar belakang AppBar
final Color? backgroundColor;
/// Warna konten AppBar
final Color? foregroundColor;
/// Fungsi yang dipanggil ketika tombol kembali ditekan
final VoidCallback? onBackPressed;
/// Konstruktor untuk CustomAppBar
const CustomAppBar({
super.key,
required this.title,
@ -22,6 +44,7 @@ class CustomAppBar extends StatelessWidget implements PreferredSizeWidget {
this.elevation = 0,
this.backgroundColor,
this.foregroundColor,
this.onBackPressed,
});
@override
@ -37,18 +60,24 @@ class CustomAppBar extends StatelessWidget implements PreferredSizeWidget {
),
centerTitle: centerTitle,
elevation: elevation,
backgroundColor: backgroundColor ?? AppTheme.primaryColor,
backgroundColor: backgroundColor ?? AppColors.primary,
foregroundColor: foregroundColor ?? Colors.white,
leading: showBackButton
? IconButton(
icon: const Icon(Icons.arrow_back, color: Colors.white),
onPressed: () => Get.back(),
)
: leading,
leading: _buildLeading(),
actions: actions,
);
}
/// Membangun widget leading berdasarkan parameter
Widget? _buildLeading() {
if (showBackButton) {
return IconButton(
icon: const Icon(Icons.arrow_back, color: Colors.white),
onPressed: onBackPressed ?? () => Get.back(),
);
}
return leading;
}
@override
Size get preferredSize => const Size.fromHeight(kToolbarHeight);
}