import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; class CustomAppBar extends StatelessWidget implements PreferredSizeWidget { final String title; final Widget? leading; final List? actions; final VoidCallback? onLeadingPressed; final bool showBottomBorder; const CustomAppBar({ super.key, required this.title, this.leading, this.actions, this.onLeadingPressed, this.showBottomBorder = true, }); @override Widget build(BuildContext context) { return AppBar( backgroundColor: Colors.white, elevation: 0, scrolledUnderElevation: 0, centerTitle: true, title: Text( title, style: TextStyle( fontFamily: 'SCDream', fontSize: 18.sp, fontWeight: FontWeight.bold, color: Colors.black, ), ), leading: leading ?? IconButton( icon: const Icon(Icons.arrow_back_ios, color: Colors.black), onPressed: onLeadingPressed ?? () => Navigator.pop(context), ), actions: actions, bottom: showBottomBorder ? PreferredSize( preferredSize: Size.fromHeight(1.h), child: Divider( color: const Color(0xFFEEEEEE), thickness: 1.h, height: 1.h, ), ) : null, ); } @override Size get preferredSize => Size.fromHeight(kToolbarHeight + (showBottomBorder ? 1.h : 0)); }