// Author: fengshengxiong // Date: 2024/5/7 // Description: BaseAppBar import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:hello_wallpaper/applovin_max/applovin_manage.dart'; import 'package:hello_wallpaper/generated/assets.dart'; import 'package:hello_wallpaper/res/themes/app_colors.dart'; class BaseAppBar extends StatelessWidget implements PreferredSizeWidget { const BaseAppBar( this.title, { super.key, this.backgroundColor, this.backWidget, this.titleStyle, this.onBackTap, }); final Color? backgroundColor; final Widget? backWidget; final String title; final TextStyle? titleStyle; final Function()? onBackTap; @override Widget build(BuildContext context) { return Container( height: preferredSize.height, padding: EdgeInsets.fromLTRB(10, ScreenUtil().statusBarHeight, 20, 0).w, color: backgroundColor ?? seedColor, child: Row( children: [ backWidget ?? ClipOval( child: Material( color: Colors.transparent, child: InkWell( onTap: onBackTap ?? () async { await ApplovinManage().showAdIfReady(ApplovinManage().adUnitId3); Get.back(); }, child: Padding( padding: const EdgeInsets.all(10).w, child: Image.asset( Assets.imagesIcBack, width: 13.w, height: 13.w, ), ), ), ), ), Flexible( child: Text( title, maxLines: 1, overflow: TextOverflow.ellipsis, style: titleStyle ?? TextStyle( color: Colors.white, fontSize: 20.sp, fontWeight: FontWeight.w500, ), ), ), ], ), ); } @override Size get preferredSize => Size.fromHeight(ScreenUtil().statusBarHeight + kToolbarHeight); }