launchAssuredConfirmDialog function

Future<void> launchAssuredConfirmDialog(
  1. BuildContext context,
  2. {required String message,
  3. required String title,
  4. Icon icon = const Icon(Icons.warning_amber_rounded),
  5. void onCancel(
      )?,
    1. required void onConfirm(
        )}
      )

      Implementation

      Future<void> launchAssuredConfirmDialog(BuildContext context,
          {required String message,
          required String title,
          Icon icon = const Icon(Icons.warning_amber_rounded),
          void Function()? onCancel,
          required void Function() onConfirm}) async {
        Debug().info(
            "Launching a ASSURED_CONFIRM_DIALOG with [$message] for ${message.hashCode}");
        final String requiredWord = LocaleUtils.RANDOM_WORDS
            .elementAt(Random().nextInt(LocaleUtils.RANDOM_WORDS.length));
        await showDialog(
            barrierDismissible: false,
            context: context,
            builder: (BuildContext context) =>
                AssuredConfirmDialogViewInput(
                    message: message,
                    title: title,
                    icon: icon,
                    requiredWord: requiredWord,
                    onCancel: () {
                      Debug().info(
                          "ASSURED_CONFIRM_DIALOG [${message.hashCode}] ended with DENY");
                      onCancel?.call();
                    },
                    onConfirm: () {
                      Debug().info(
                          "ASSURED_CONFIRM_DIALOG [${message.hashCode}] ended with CONFIRM");
                      onConfirm.call();
                    }));
      }