Диалог предупреждений не удаляется при трепете - PullRequest
0 голосов
/ 07 мая 2020

Я нажал на экран из слайд-меню как:

Navigator.of(context).pushReplacementNamed(AskQueriesScreen.routeName);

Теперь, когда я пробую Rest Api:

final products = Provider.of<Products>(context);
                             setState(() {
                               isLoading = true;
                             });
                             products.submitQuery(Product(
                                   id:'',
                                   title: _titleController.text,
                                   imageUrl: '',
                                   description: '',
                                   createdat: DateTime.now(),
                                   isFavorite: false
                                )
                               ).then((result){
                                 setState(() {
                                    isLoading = false;
                                 });
                                  print(result);


                                   Alert(
                                  context: context,
                                  type: result == 'success' ? AlertType.success : AlertType.error,
                                  title: result.toUpperCase(),
                                  desc: "We Will Back To You Soon.",
                                  buttons: [
                                    DialogButton(
                                      child: Text(
                                        "Ok",
                                        style: TextStyle(color: Colors.white, fontSize: 20),
                                      ),
                                      onPressed: () => {Navigator.pop(context)},
                                      width: 120,
                                    )
                                  ],
                                ).show();

                               });

После того, как я нажал «ОК», я не смог удалить всплывающее окно вверх с экрана, используя

Navigator.pop(context)

Любая помощь будет оценена,

...