buildAppBar static method

PreferredSizeWidget buildAppBar({
  1. required BuildContext context,
  2. required String title,
  3. VoidCallback? onBackPressed,
})

Implementation

static PreferredSizeWidget buildAppBar({
  required BuildContext context,
  required String title,
  VoidCallback? onBackPressed,
}) {
  final colorsTheme = BaseThemeProvider.colorsOf(context);

  return AppBar(
    backgroundColor: colorsTheme.bgColorOperate,
    scrolledUnderElevation: 0,
    leading: IconButton.buttonContent(
      content: IconOnlyContent(Icon(Icons.arrow_back_ios, color: colorsTheme.buttonColorPrimaryDefault)),
      type: ButtonType.noBorder,
      size: ButtonSize.l,
      onClick: onBackPressed ?? () => Navigator.of(context).pop(),
    ),
    title: Text(
      title,
      style: TextStyle(
        color: colorsTheme.textColorPrimary,
        fontSize: 16,
        fontWeight: FontWeight.w600,
      ),
    ),
    centerTitle: true,
    bottom: PreferredSize(
      preferredSize: const Size.fromHeight(1),
      child: Container(
        height: 1,
        color: colorsTheme.strokeColorPrimary,
      ),
    ),
  );
}