import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import '../resource/assets.gen.dart'; class CommonAppBar extends StatelessWidget implements PreferredSizeWidget { final String title; final VoidCallback? onBack; final Color Function() backgroundColor; const CommonAppBar({ super.key, required this.title, required this.backgroundColor, this.onBack, }); @override @override Widget build(BuildContext context) { return AppBar( scrolledUnderElevation: 0, backgroundColor: backgroundColor(), leadingWidth: 40.w, leading: Padding( padding: EdgeInsets.only(left: 16.w), child: GestureDetector( onTap: onBack ?? Get.back, child: Assets.images.iconMineBackArrow.image( width: 24.w, height: 24.h, ), ), ), centerTitle: true, title: Text( title, textAlign: TextAlign.center, style: TextStyle( color: Colors.black.withAlpha(204), fontSize: 17.sp, fontWeight: FontWeight.w500, height: 1.18.h, ), ), ); } @override Size get preferredSize => Size.fromHeight(kToolbarHeight); }