import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:marco/controller/project_controller.dart'; import 'package:marco/helpers/widgets/my_spacing.dart'; import 'package:marco/helpers/widgets/my_text.dart'; class CustomAppBar extends StatelessWidget implements PreferredSizeWidget { final String title; final VoidCallback? onBackPressed; const CustomAppBar({ super.key, required this.title, this.onBackPressed, }); @override Widget build(BuildContext context) { return PreferredSize( preferredSize: const Size.fromHeight(72), child: AppBar( backgroundColor: const Color(0xFFF5F5F5), elevation: 0.5, automaticallyImplyLeading: false, titleSpacing: 0, title: Padding( padding: MySpacing.xy(16, 0), child: Row( crossAxisAlignment: CrossAxisAlignment.center, children: [ IconButton( icon: const Icon( Icons.arrow_back_ios_new, color: Colors.black, size: 20, ), onPressed: onBackPressed ?? () => Get.back(), ), MySpacing.width(5), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ // TITLE MyText.titleLarge( title, fontWeight: 700, color: Colors.black, ), MySpacing.height(2), // PROJECT NAME ROW (copied exactly) GetBuilder( builder: (projectController) { final projectName = projectController.selectedProject?.name ?? 'Select Project'; return Row( children: [ const Icon(Icons.work_outline, size: 14, color: Colors.grey), MySpacing.width(4), Expanded( child: MyText.bodySmall( projectName, fontWeight: 600, overflow: TextOverflow.ellipsis, color: Colors.grey[700], ), ), ], ); }, ), ], ), ), ], ), ), ), ); } @override Size get preferredSize => const Size.fromHeight(72); }