getCustomHeader function

Widget getCustomHeader(
  1. BuildContext context,
  2. String title, {
  3. void backFunction()?,
  4. void rightFunction()?,
  5. String iconName = "setting",
})

Implementation

Widget getCustomHeader(
  BuildContext context,
  String title, {
  void Function()? backFunction,
  void Function()? rightFunction,
  String iconName = "setting",
}) {
  double appbarPadding = MahasDimensions.getAppBarPadding();
  double toolbarHeight = MahasDimensions.getToolbarHeight(context);
  return Container(
    color: MahasColors.primaryColor,
    child: Column(
      children: [
        Container(
          width: double.infinity,
          padding: EdgeInsets.only(
              top: MahasDimensions.getToolbarTopHeight(context),
              left: appbarPadding,
              right: appbarPadding),
          height: toolbarHeight,
          child: Stack(
            children: [
              Align(
                alignment: Alignment.centerLeft,
                child: SizedBox(
                  height: double.infinity,
                  child: InkWell(
                    onTap: backFunction,
                    child: getIcon(
                      'arrow_left',
                      color: MahasColors.whiteColor,
                      size: MahasDimensions.getHeightPercentSize(
                          MahasDimensions.fontSizeExtraLarge),
                    ),
                  ),
                ),
              ),
              Center(
                child: getCustomText(
                  title,
                  align: TextAlign.center,
                  weight: FontWeight.bold,
                  color: MahasColors.whiteColor,
                  size: MahasDimensions.getHeightPercentSize(
                      MahasDimensions.fontSizeLarge),
                ),
              ),
              Visibility(
                visible: rightFunction != null,
                child: Align(
                  alignment: Alignment.centerRight,
                  child: SizedBox(
                    height: double.infinity,
                    child: InkWell(
                      onTap: rightFunction,
                      child: getIcon(
                        iconName,
                        color: MahasColors.whiteColor,
                        size: MahasDimensions.getHeightPercentSize(
                            MahasDimensions.fontSizeExtraLarge),
                      ),
                    ),
                  ),
                ),
              ),
            ],
          ),
        ),
      ],
    ),
  );
}