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:
@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user