costum2 static method

Widget costum2({
  1. Icon? icon,
  2. String? text,
  3. Color? background,
  4. required dynamic onPressed,
  5. bool loadingStatus = false,
  6. bool enabled = true,
})

Implementation

static Widget costum2({
  Icon? icon,
  String? text,
  Color? background,
  required onPressed,
  bool loadingStatus = false,
  bool enabled = true,
}) {
  // background = ARMOYU.buttonColor;

  List<Widget> aa = [];

  if (icon != null) {
    aa.add(icon);
  }
  if (text != null) {
    aa.add(const SizedBox(width: 6));
    aa.add(Text(text));
  }
  return loadingStatus
      ? const CupertinoActivityIndicator()
      : ElevatedButton(
          onPressed: !enabled ? null : onPressed,
          style: ElevatedButton.styleFrom(
            backgroundColor: enabled
                ? Get.theme.highlightColor.withValues(alpha: 0.3)
                : Colors.red,
            foregroundColor: Colors.white,
            padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 10),
            shape: RoundedRectangleBorder(
              borderRadius: BorderRadius.circular(10),
            ),
          ),
          child: Row(
            mainAxisAlignment: MainAxisAlignment.center,
            crossAxisAlignment: CrossAxisAlignment.center,
            children: aa,
          ),
        );
}