getCustomAppBar method

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

Implementation

getCustomAppBar(BuildContext context,
    {required String? appBarTitle,
    required Function? onBackButtonPress,
    Color? backgroundColor,
    double? elevation,
    bool? centerTitle,
    List<Widget>? actions,
    Widget? icon,
    bool? isIconVisible,
    bool? isNext,
    Color? appTitleColor,
    Widget? titleWidget,
    Color? iconColor}) {
  return AppBar(
    iconTheme: IconThemeData(
      color: iconColor ??= AppColors.appColorBlack85, //change your color here
    ),
    title: titleWidget ??
        Text(
          appBarTitle ?? "",
          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 ??= true,
        child: IconButton(
          icon: icon ??= const Icon(
            Icons.keyboard_backspace_rounded,
          ),
          onPressed: onBackButtonPress as void Function()?,
        )),
    actions: actions,
    centerTitle: centerTitle ??= true,
  );
}