costum1 static method

Widget costum1({
  1. required String text,
  2. Color? background,
  3. required Function onPressed,
  4. required Rx<bool> loadingStatus,
  5. bool enabled = true,
})

Implementation

static Widget costum1({
  required String text,
  Color? background,
  required Function onPressed,
  required Rx<bool> loadingStatus,
  bool enabled = true,
}) {
  Color foregroundColor = Colors.white;

  return loadingStatus.value
      ? const CupertinoActivityIndicator()
      : ElevatedButton(
          onPressed: !enabled
              ? null
              : () async {
                  if (!loadingStatus.value) {
                    await onPressed();
                  }
                },
          style: ElevatedButton.styleFrom(
            backgroundColor: background, // Arka plan rengini belirleyin
            foregroundColor: foregroundColor,
            padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 18),
            shape: RoundedRectangleBorder(
              borderRadius:
                  BorderRadius.circular(10), // Kenar yarıçapını ayarlayın
            ),
          ),
          child: Text(
            text,
            style: const TextStyle(
              fontWeight: FontWeight.bold,
              fontSize: 16,
            ),
          ),
        );
}