getx icon indicating copy to clipboard operation
getx copied to clipboard

when I use Get.dialog() to show a dialog, then I use Get.back() back dialog, at the same time ,the page widget's getxController operator onClose(), how to solve this problem.

Open tomato-m opened this issue 2 years ago • 5 comments

the page structure as follow: mainPage with bottomNavigationBar and the PageView with other page, I use Get.dialog() show a dialog in mainpPage OnReady(), when dialog dismiss, the widget's getxController of other page operators onClose() override function, how to solve this problem.

tomato-m avatar Dec 14 '23 03:12 tomato-m

I use showDialog() show a dialog, when dialog dismiss,widget's getxController will not be closed;

tomato-m avatar Dec 14 '23 03:12 tomato-m

I also experienced this problem when upgrading Flutter 3.16.3 • channel stable and Flutter 3.16.4 • channel stable and couldn't find a solution

In the following figure code, I put Get.close(1); Change to Navigator.of(context).pop(); Can solve the problem

But the onCancel method in Get.defaultDialog is a little tricky to handle

image
                                  String tips = '确认删除吗?删除后不可恢复。'.tr;

                                        n.showDialog(
                                          context: Get.context!,
                                          builder: (context) => n.Alert()
                                            ..content = SizedBox(
                                              height: 40,
                                              child: Center(child: Text(tips)),
                                            )
                                            ..actions = [
                                              n.Button('取消'.tr.n)
                                                ..style = n.NikuButtonStyle(
                                                    foregroundColor:
                                                        AppColors.ItemOnColor)
                                                ..onPressed = () {
                                                  Navigator.of(context).pop();
                                                },
                                              n.Button('删除'.tr.n)
                                                ..style = n.NikuButtonStyle(
                                                    foregroundColor:
                                                        AppColors.ItemOnColor)
                                                ..onPressed = () async {
                                                  Navigator.of(context).pop();
                                                  bool res = await logic.remove(
                                                    model.feedbackId,
                                                  );
                                                  if (res) {
                                                    state.itemList.removeAt(
                                                      state.itemList.indexWhere(
                                                          (e) =>
                                                              e.feedbackId ==
                                                              model.feedbackId),
                                                    );
                                                    EasyLoading.showSuccess(
                                                        '操作成功'.tr);
                                                  } else {
                                                    EasyLoading.showError(
                                                        '操作失败'.tr);
                                                  }
                                                },
                                            ],
                                          barrierDismissible: true,
                                        );

leeyisoft avatar Dec 18 '23 01:12 leeyisoft

It happened to me recently, the problem seems to be when you close (Get.back) the dialog, or the sheet when you change the view or in another controller, but doing everything in the same view and controller solved the problem.

PabloCir avatar Jan 09 '24 03:01 PabloCir

me to

57912130 avatar Jan 26 '24 03:01 57912130