Home > front end >  Loading not closing with Navigator.pop context
Loading not closing with Navigator.pop context

Time:11-21

void  _onLoading() {
                        showDialog(
                          context: context,
                          barrierDismissible: false,
                          builder: (BuildContext context) {
                            return Dialog(
                              child: new Row(
                                mainAxisSize: MainAxisSize.min,
                                children: [
                                  new CircularProgressIndicator(),
                                  new Text("Loading"),
                                ],
                              ),
                            );
                          },
                        );

                      }
                      _onLoading();
                      instaprofile result = await getProfile(user.user!.username.toString());
                      Navigator.pop(context);

                      Navigator.push(
                        context,
                        MaterialPageRoute(builder: (context) =>  ProfilePage(userbio:result)),
                      );

Hello , I'm trying to show the "loading" screen. But I can't turn it off.thank you for your help.I know what I'm doing may not be right. I'm trying to learn.

CodePudding user response:

Try replace

Navigator.pop(context);

With this:

Navigator.of(context, rootNavigator: true).pop();
  • Related