警报对话框未消除

时间:2020-05-07 08:56:34

标签: flutter flutter-layout dart-pub

我将幻灯片菜单中的屏幕推为:

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)

任何帮助将不胜感激,

0 个答案:

没有答案