pumaButton function

Widget pumaButton({
  1. String text = "",
  2. String? subtitle,
  3. Color color = Colors.white,
  4. Color textcolor = Colors.black,
  5. bool disabled = false,
  6. Icon? icon,
  7. required void onPressed(),
})

Implementation

Widget pumaButton({
  String text = "",
  String? subtitle,
  Color color = Colors.white,
  Color textcolor = Colors.black,
  bool disabled = false,
  Icon? icon,
  required void Function() onPressed,
}) {
  return Opacity(
    opacity: disabled ? 0.5 : 1,
    child: ElevatedButton(
      child: Container(
        child: FittedBox(
          fit: BoxFit.scaleDown,
          alignment: Alignment.topCenter,
          child: Row(
            crossAxisAlignment: CrossAxisAlignment.center,
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              if (icon != null) icon,
              Text(
                text,
                style: TextStyle(
                    fontFamily: "Futura-Bold", fontSize: 18, color: textcolor),
              ),
              if (subtitle != null)
                Opacity(
                  opacity: 0.58,
                  child: Text(
                    text,
                    style: TextStyle(
                        fontFamily: "Futura-Bold",
                        fontSize: 12,
                        color: textcolor),
                  ),
                ),
            ],
          ),
        ),
      ),
      style: ButtonStyle(
        backgroundColor: MaterialStateProperty.all(color),
      ),
      onPressed: disabled ? null : onPressed,
    ),
  );
}