confirm<T> method

Future<T?> confirm<T>({
  1. String? title,
  2. String? content,
  3. String? lottiePath,
  4. String? labelNoButton,
  5. dynamic onNoClicked()?,
  6. String? labelYesButton,
  7. required dynamic onYesClicked()?,
  8. Widget? customWidget,
  9. bool isBackAfterYes = true,
})

Implementation

Future<T?> confirm<T>({
  String? title,
  String? content,
  String? lottiePath,
  String? labelNoButton,
  Function()? onNoClicked,
  String? labelYesButton,
  required Function()? onYesClicked,
  Widget? customWidget,
  bool isBackAfterYes = true,
}) async {
  // await GetxFire.progressHud.hide();
  return await showAnimatedDialog(
    context: Get.context!,
    barrierDismissible: true,
    animationType: animationType,
    curve: Curves.fastOutSlowIn,
    duration: const Duration(milliseconds: 500),
    builder: (_) => ConfirmDialog(
      title: title,
      content: content,
      lottiePath: lottiePath,
      labelLeftButton: labelNoButton,
      customWidget: customWidget,
      onLeftPressed: () {
        Get.back();
        if (onNoClicked != null) onNoClicked();
      },
      labelRightButton: labelYesButton,
      onRightPressed: () {
        if (isBackAfterYes) Get.back();
        if (onYesClicked != null) onYesClicked();
      },
    ),
  );
}