simpleAppBar function

PreferredSizeWidget simpleAppBar({
  1. String title = "",
  2. TextStyle? titleStyle,
  3. Color backgroundColor = AppColor.appWhite,
  4. List<Widget>? actions,
  5. dynamic onBackPressed()?,
  6. bool hideBackButton = false,
  7. bool centerTitle = false,
})

Implementation

PreferredSizeWidget simpleAppBar({
  String title = "",
  TextStyle? titleStyle,
  Color backgroundColor = AppColor.appWhite,
  List<Widget>? actions,
  Function()? onBackPressed,
  bool hideBackButton = false,
  bool centerTitle = false,
}) {
  return AppBar(
    centerTitle: centerTitle,
    title: Text(
      title,
      style:
          titleStyle ??
          const TextStyle(
            color: AppColor.appBlack,
            fontSize: 18,
            fontWeight: FontWeight.w600,
          ),
    ),
    leading:
        hideBackButton
            ? const SizedBox.shrink()
            : GestureDetector(
              onTap: onBackPressed,
              child: const Icon(
                Icons.arrow_back_ios_new,
                color: AppColor.appBlack,
              ),
            ),
    backgroundColor: backgroundColor,
    actions: actions,
    elevation: 0,
  );
}