customButton static method

dynamic customButton({
  1. String? buttonText,
  2. Color? buttonColor,
  3. double? cornerRadius,
  4. dynamic onClick,
  5. dynamic textColor,
  6. double? fontSize,
  7. double? verticalPadding,
  8. double? horizontalPadding,
  9. ButtonStyle? style,
})

Implementation

static customButton(
    {String? buttonText,
    Color? buttonColor,
    double? cornerRadius,
    onClick,
    var textColor,
    double? fontSize,
    double? verticalPadding,
    double? horizontalPadding,
    ButtonStyle? style}) {
  return ElevatedButton(
      onPressed: onClick ?? () {},
      style: ElevatedButton.styleFrom(
          backgroundColor: buttonColor ?? Colors.green,
          shape: RoundedRectangleBorder(
              borderRadius: BorderRadius.circular(cornerRadius ?? 100.0)),
          padding: EdgeInsets.symmetric(
              vertical: verticalPadding ?? 16.0,
              horizontal: horizontalPadding ?? 10.0)),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.center,
        children: [
          Text(
            buttonText!,
            style: TextStyle(
                color: textColor ?? Colors.white,
                fontSize: fontSize ?? 16.0,
                fontWeight: FontWeight.w600,
                height: 1.5),
          ),
          const SizedBox(
            width: 5.0,
          ),
        ],
      ));
}