gradientButton2 static method

Widget gradientButton2({
  1. required String text,
  2. Color textColor = Colors.white,
  3. double? width,
  4. double? height,
  5. double radius = buttonRadius,
  6. double fontSize = buttonFontSize,
  7. VoidCallback? onPressed,
  8. Gradient? gradient,
  9. EdgeInsetsGeometry? margin,
  10. EdgeInsetsGeometry? padding,
  11. Color? borderColor,
})

Implementation

static Widget gradientButton2(
    {required String text,
    Color textColor = Colors.white,
    double? width,
    double? height,
    double radius = buttonRadius,
    double fontSize = buttonFontSize,
    VoidCallback? onPressed,
    Gradient? gradient,
    EdgeInsetsGeometry? margin,
    EdgeInsetsGeometry? padding,
    Color? borderColor}) {
  return ElevatedButton(
      onPressed: onPressed,
      style: ButtonStyle(
        maximumSize: MaterialStateProperty.all(const Size(double.infinity, double.infinity)),
        minimumSize: MaterialStateProperty.all(const Size(0, 0)),
        backgroundColor: ButtonStyleButton.allOrNull<Color>(Colors.transparent),
        overlayColor: ButtonStyleButton.allOrNull<Color>(Colors.transparent),
        elevation: ButtonStyleButton.allOrNull<double>(0),
        padding: ButtonStyleButton.allOrNull<EdgeInsetsGeometry>(margin ?? EdgeInsets.zero),
      ),
      child: Container(
          alignment: Alignment.center,
          padding: padding,
          height: height,
          width: width,
          decoration: BoxDecoration(gradient: gradient, borderRadius: BorderRadius.all(Radius.circular(radius))),
          child: TextStyle(color: textColor, fontSize: fontSize).centerText(text)));
}