import 'package:flutter/material.dart';
import 'package:get/get.dart';


class DialogController extends GetxController {
  var isDialogVisible = false.obs;
  void showErrorDialog() {
    isDialogVisible.value = true;
  }

  Future<bool?> showNormalDialog({
    required String title,
    String? content,
    Widget? child,
    required String cancelText,
    required String enterText,
    bool Function()? validator,
  }) {
    assert(content != null || child != null);

    return Get.dialog(
      AlertDialog(
        title: Text(title),
        content: child ?? Text(content!),
        actions: [
          TextButton(
            onPressed: () => Get.back(result: false),
            child: Text(cancelText),
          ),
          TextButton(
            onPressed: () => Get.back(result: true),
            child: Text(enterText),
          ),
        ],
      ),
    );
  }
}
