【问题标题】:Picture from cloud storage showing in debug mode but not in release apk-flutter来自云存储的图片以调试模式显示,但未在发布 apk-flutter 中显示
【发布时间】:2022-11-10 15:45:21
【问题描述】:

我正在通过流构建器将图像从 firebase 云存储显示到颤振应用程序。按下按钮时,我在警报对话框中显示图像。图片在调试模式下显示正常,但在发布模式下不显示。我尝试使用 --no-shrink 获取 apk,但错误仍然相同。我的功能是当用户从下拉菜单中选择月份和年份并按下按钮时,该月的警报对话框中会显示一张图片,该图片保存在云存储中。 Picture in release apkPicture in debug mode

**Future showimage() async {
return showDialog(
    context: context,
    builder: (BuildContext context) {
      return Container(
        width: MediaQuery.of(context).size.width * 0.9,
        height: MediaQuery.of(context).size.height * 0.8,
        child: AlertDialog(
            content: Expanded(
          child: FutureBuilder(
            future: storage.downloadedUrl('${dropdownmonth}${dropdowndate}', '${dropdownmonth}${dropdowndate}Record'),
            builder: (BuildContext context, AsyncSnapshot<String> snap) {
              if (snap.connectionState == ConnectionState.done &&
                  snap.hasData) {
                return Expanded(
                  child: ListView.builder(
                      itemCount: 1,
                      itemBuilder: (BuildContext context, index) {
                        return Container(
                            width: 400,
                            height: 450,
                            child: Image.network(
                              snap.data!,
                              fit: BoxFit.cover,
                            ));
                      }),
                );
                //Container(width: 300,height: 450,
                // child: Image.network(snap.data!,
                // fit: BoxFit.cover,),
              }
              if (snap.connectionState == ConnectionState.waiting) {
                return Center(child: CircularProgressIndicator());
              }
              if(snap.data==null){
                return Center(child: Text("No Report Found"));
              }
              return Container();
            },
          ),
        )),
      );
    });

}**

【问题讨论】:

    标签: android firebase flutter dart cloud-storage


    【解决方案1】:

    通过删除一些小部件(如扩展、flex)解决了这个问题。我通过 flutter run --release 以发布心情运行更新

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-07-15
      • 1970-01-01
      • 2021-05-01
      • 2022-01-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-12-03
      相关资源
      最近更新 更多