Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alertify not properly dismissing, popping back to the previous fullscreen page. #3

Open
GwynmeTheos opened this issue Jun 11, 2021 · 0 comments

Comments

@GwynmeTheos
Copy link

GwynmeTheos commented Jun 11, 2021

Hello, I"m currently having some trouble with implementing Alertify into our code. The following code is the request to our API to validate a user's document (details are obfuscated due to proprietary code).

void postRequestFunction() async {
    if (...) {
      showAlertDialog(context);
      ...URL cleanup code
      ...Document cleanup code
      try {
        // Send request code
        if (res.statusCode == 200) {
          Navigator.of(context, rootNavigator: true).pop();
          print(resBody);
          Navigator.push(context,
              MaterialPageRoute(builder: (context) => ValidarTokenSMS()));
        } else {
          Navigator.of(context, rootNavigator: false).pop();
          Alertify(
            content: body,
            context: context,
            isDismissible: true,
            title: title,
            alertType: AlertifyType.warning,
            buttonText: 'Ok',
            animationType: AnimationType.outToIn).show();
        }
      } catch (error) {
        await utils.reportError(error);
      }
    } else {
      Alertify(
        content: body,
        context: context,
        isDismissible: true,
        title: title,
        alertType: AlertifyType.warning,
        buttonText: 'Ok',
        animationType: AnimationType.outToIn)
      .show();
    }
  }

The problem that is happening is:

I'm entering the signup page. Then the user types in the stuff, it sends the request and we open a popup to say it's loading. It returns an error (intentional). The Alertify popup appears. I click the ok to dismiss, it pops me back to the login page, but doesn't pop the Alertify popup - continuing to click the ok throws FlutterErrors (for trying to pop a guy that is no longer in the widget tree). It does let me click outside the popup to dismiss it, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant