getCustomAppBarWithProfileImage method

dynamic getCustomAppBarWithProfileImage(
  1. BuildContext context, {
  2. required String appBarTitle,
  3. required Function onBackButtonPress,
  4. Color? backgroundColor,
  5. double? elevation,
  6. required String imageUrl,
  7. bool? centerTitle,
  8. List<Widget>? actions,
  9. Widget? icon,
  10. bool? isIconVisible,
  11. bool? isNext,
  12. Color? appTitleColor,
  13. Color? iconColor,
})

Implementation

getCustomAppBarWithProfileImage(BuildContext context,
    {required String appBarTitle,
    required Function onBackButtonPress,
    Color? backgroundColor,
    double? elevation,
    required String imageUrl,
    bool? centerTitle,
    List<Widget>? actions,
    Widget? icon,
    bool? isIconVisible,
    bool? isNext,
    Color? appTitleColor,
    Color? iconColor}) {
  return AppBar(
    iconTheme: IconThemeData(
      color: iconColor ??=
          AppColors.primaryTextColor, //change your color here
    ),
    title: Row(
      mainAxisSize: MainAxisSize.min,
      mainAxisAlignment: MainAxisAlignment.start,
      children: [
        Visibility(
            visible: isIconVisible ??= true,
            child: IconButton(
              icon: icon ??= const Icon(
                Icons.keyboard_backspace_rounded,
                size: 20,
                // add custom icons also
              ),
              onPressed: onBackButtonPress as void Function()?,
            )),
        Text(
          appBarTitle,
          // ignore: unnecessary_null_comparison
          style: appBarTitle != null
              ? TextStyleElements.headline6
                  .copyWith(color: appTitleColor, fontWeight: FontWeight.w600)
              : TextStyleElements.headline5,
        ),
      ],
    ),
    backgroundColor: backgroundColor ??= AppColors.appColorTransparent,
    elevation: elevation ??= 0.0,
    leading: Visibility(
        visible: isIconVisible,
        child: IconButton(
          icon: icon,
          onPressed: onBackButtonPress as void Function()?,
        )),
    actions: actions,
    centerTitle: centerTitle ??= true,
  );
}