onufitness_mobile/lib/widgets/appbars/custom_appbar.dart
2026-01-13 11:36:24 +05:30

50 lines
1.3 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:onufitness/constants/color_constant.dart';
import 'package:onufitness/utils/helper_function.dart';
class CustomAppBar extends StatelessWidget implements PreferredSizeWidget {
final String? title;
final Color? backgroundColor;
final Color? textColor;
final bool automaticallyImplyLeading;
final List<Widget>? actions;
final double? titleFontSize;
final Widget? leading;
const CustomAppBar({
super.key,
this.title,
this.backgroundColor,
this.textColor,
this.automaticallyImplyLeading = true,
this.actions,
this.titleFontSize,
this.leading,
});
@override
Widget build(BuildContext context) {
return AppBar(
backgroundColor: backgroundColor ?? Color(primaryColor),
automaticallyImplyLeading: automaticallyImplyLeading,
leading: leading,
title:
title != null
? Text(
title!,
style: TextStyle(
fontSize: titleFontSize ?? (isTablet ? 24.sp : 20.sp),
fontWeight: FontWeight.w600,
color: textColor ?? Colors.white,
),
)
: null,
actions: actions,
);
}
@override
Size get preferredSize => Size.fromHeight(56.h);
}