buttonChild method

Widget buttonChild(
  1. ImosysConfig config,
  2. BuildContext context
)

Implementation

Widget buttonChild(ImosysConfig config, BuildContext context) {
  return width == null && config.primaryButtonDefaultWidth == null
      ? Padding(
          padding: EdgeInsets.symmetric(
              vertical: verticalPadding ??
                  config.primaryButtonVerticalPadding ??
                  3.0),
          child: Center(
            child: image == null && icon == null
                ? ImosysTextWidget(
                    text: text,
                    size: textSize ?? config.primaryButtonFontSize,
                    fontFamily:
                        textFontFamily ?? config.primaryButtonTextFontFamily,
                    fontWeight: textFontWeight,
                    align: textAlign,
                    color: textColor ?? config.primaryButtonTextColor)
                : icon == null
                    ? Row(
                        mainAxisAlignment: MainAxisAlignment.center,
                        children: [
                          ExtendedImage.asset(
                            image!,
                            height: imageHeight ?? 20,
                            width: imageWidth,
                          ),
                          const SizedBox(
                            width: 10,
                          ),
                          ImosysTextWidget(
                              text: text,
                              size: textSize ?? config.primaryButtonFontSize,
                              fontFamily: textFontFamily ??
                                  config.primaryButtonTextFontFamily,
                              fontWeight: textFontWeight,
                              align: textAlign,
                              color:
                                  textColor ?? config.primaryButtonTextColor)
                        ],
                      )
                    : Row(
                        mainAxisAlignment: MainAxisAlignment.center,
                        children: [
                          Icon(
                            icon,
                            color: iconColor,
                            size: iconSize ?? 20,
                          ),
                          const SizedBox(
                            width: 10,
                          ),
                          ImosysTextWidget(
                            text: text,
                            size: textSize ?? config.primaryButtonFontSize,
                            fontFamily: textFontFamily ??
                                config.primaryButtonTextFontFamily,
                            fontWeight: textFontWeight,
                            align: textAlign,
                            color: textColor ?? config.primaryButtonTextColor,
                          ),
                        ],
                      ),
          ),
        )
      : SizedBox(
          width: width ??
              config.primaryButtonDefaultWidth ??
              MediaQuery.of(context).size.width * 0.5,
          //height: 25,
          child: Padding(
            padding: EdgeInsets.symmetric(
                vertical: verticalPadding ??
                    config.primaryButtonVerticalPadding ??
                    3.0),
            child: Center(
              child: image == null && icon == null
                  ? ImosysTextWidget(
                      text: text,
                      size: textSize ?? config.primaryButtonFontSize,
                      fontFamily: textFontFamily ??
                          config.primaryButtonTextFontFamily,
                      fontWeight: textFontWeight,
                      align: textAlign,
                      color: textColor ?? config.primaryButtonTextColor,
                    )
                  : icon == null
                      ? Row(
                          mainAxisAlignment: MainAxisAlignment.center,
                          children: [
                            ExtendedImage.asset(image!, height: imageHeight ?? 20, width: imageWidth,),
                            const SizedBox(
                              width: 10,
                            ),
                            ImosysTextWidget(
                              text: text,
                              size: textSize ?? config.primaryButtonFontSize,
                              fontFamily: textFontFamily ??
                                  config.primaryButtonTextFontFamily,
                              fontWeight: textFontWeight,
                              align: textAlign,
                              color: textColor ??
                                  ImosysAppWrapper.of(context)
                                      .primaryButtonTextColor,
                            )
                          ],
                        )
                      : Row(
                          mainAxisAlignment: MainAxisAlignment.center,
                          children: [
                            Icon(
                              icon,
                              color: iconColor,
                              size: iconSize ?? 20,
                            ),
                            const SizedBox(
                              width: 10,
                            ),
                            ImosysTextWidget(
                              text: text,
                              size: textSize ?? config.primaryButtonFontSize,
                              fontFamily: textFontFamily ??
                                  config.primaryButtonTextFontFamily,
                              fontWeight: textFontWeight,
                              align: textAlign,
                              color:
                                  textColor ?? config.primaryButtonTextColor,
                            ),
                          ],
                        ),
            ),
          ),
        );
}