0

我面临问题。我的应用程序在模拟器中运行良好,但在发布模式或移动设备中,它显示以下代码的灰色框。我正在使用 Getx 包。想不通。

请帮忙。

Positioned(
              bottom: 0,
              child: Obx(() {
                if (appBarController.isDataProcessing.value == false) {
                  if (appBarController.loggedUserData[0] != null) {
                    return GestureDetector(
                      onTap: () {
                        // print('id');
                        appBarController.getAlumniProfile(
                            appBarController.loggedUserData[0]['id']);
                      },
                      child: Hero(
                        tag: appBarController.loggedUserData[0]['id'].toString(),
                        child: appBarController.loggedUserData[0]['user_image'] !=
                                null
                            ? Container(
                                height: 50,
                                width: 50,
                                decoration: BoxDecoration(
                                  border: Border.all(width: 0.5),
                                  shape: BoxShape.circle,
                                  image: DecorationImage(
                                    fit: BoxFit.cover,
                                    image: NetworkImage(
                                      appBarController.loggedUserData[0]
                                          ['user_image'],
                                    ),
                                  ),
                                ),
                              )
                            : Container(
                                decoration: BoxDecoration(
                                  border:
                                      Border.all(width: 0.5, color: Colors.white),
                                  shape: BoxShape.circle,
                                ),
                                child: Icon(
                                  Icons.person,
                                  size: 30,
                                  color: Colors.white,
                                ),
                              ),
                      ),
                    );
                  } else {
                    return Center(
                      child: SizedBox(),
                    );
                  }
                } else {
                  return Center(
                    child: CircularProgressIndicator(),
                  );
                }
              }),
            )

谢谢

这是我的问题的屏幕截图。

更新代码(工作代码)

Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  Obx(() {
                    if (appBarController.isDataProcessing.value == false) {
                      if (appBarController.loggedUserData[0] != null) {
                        return GestureDetector(
                          onTap: () {
                            // print('id');
                            appBarController.getAlumniProfile(
                                appBarController.loggedUserData[0]['id']);
                          },
                          child: Hero(
                            tag: appBarController.loggedUserData[0]['id']
                                .toString(),
                            child: appBarController.loggedUserData[0]
                                        ['user_image'] !=
                                    null
                                ? Container(
                                    height: 50,
                                    width: 50,
                                    decoration: BoxDecoration(
                                      border: Border.all(width: 0.5),
                                      shape: BoxShape.circle,
                                      image: DecorationImage(
                                        fit: BoxFit.cover,
                                        image: NetworkImage(
                                          appBarController.loggedUserData[0]
                                              ['user_image'],
                                        ),
                                      ),
                                    ),
                                  )
                                : Container(
                                    decoration: BoxDecoration(
                                      border: Border.all(
                                          width: 0.5, color: Colors.white),
                                      shape: BoxShape.circle,
                                    ),
                                    child: Icon(
                                      Icons.person,
                                      size: 30,
                                      color: Colors.white,
                                    ),
                                  ),
                          ),
                        );
                      } else {
                        return Center(
                          child: SizedBox(),
                        );
                      }
                    } else {
                      return Center(
                        child: CircularProgressIndicator(),
                      );
                    }
                  }),

                  IconButton(
                    onPressed: () {
                      logout();
                    },
                    icon: Icon(Icons.exit_to_app),
                    tooltip: 'Log out',
                    color: Colors.white,
                    iconSize: 30,
                  ),
                  // Text(appBarController.loggedUserData[0]['id'].toString()),
                ],
              )

我学会了解决问题。这对我来说是一种乐趣。谢谢

4

2 回答 2

0

基本上grey box发布模式下是指error如果在调试模式下发生相同的错误,那么它会显示一个红屏。但是正如您所说,此错误未在调试模式下显示,那么您可以通过在配置文件模式下运行您的应用程序来找到导致部分的其他选项。有一些error忽略debug mode,但它会反映在profile mode.

于 2022-01-06T11:10:26.810 回答
0

你有权限ManifestInternet

于 2022-01-06T10:43:25.207 回答