import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:penyaluran_app/app/theme/app_theme.dart'; class CustomAppBar extends StatelessWidget implements PreferredSizeWidget { final String title; final bool showBackButton; final List? actions; final Widget? leading; final bool centerTitle; final double elevation; final Color? backgroundColor; final Color? foregroundColor; const CustomAppBar({ Key? key, required this.title, this.showBackButton = false, this.actions, this.leading, this.centerTitle = true, this.elevation = 0, this.backgroundColor, this.foregroundColor, }) : super(key: key); @override Widget build(BuildContext context) { return AppBar( title: Text( title, style: TextStyle( fontSize: 18, fontWeight: FontWeight.bold, color: foregroundColor ?? Colors.white, ), ), centerTitle: centerTitle, elevation: elevation, backgroundColor: backgroundColor ?? AppTheme.primaryColor, foregroundColor: foregroundColor ?? Colors.white, leading: showBackButton ? IconButton( icon: const Icon(Icons.arrow_back, color: Colors.white), onPressed: () => Get.back(), ) : leading, actions: actions, ); } @override Size get preferredSize => const Size.fromHeight(kToolbarHeight); }