BoxDecoration中显示来自网络的图像

BoxDecoration中显示来自网络的图像

本文介绍了如何在Flutter BoxDecoration中显示来自网络的图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在BoxDecoration中显示网络的图像.但是它显示错误

I want to show an image of the network in BoxDecoration. But its showing error

这是我尝试从盒子装饰中的网络显示图像的代码.请检查并让我知道此代码中的错误之处.

Here is the code where I am trying to show an image from the network inside box decoration. Please check and do let me know where I am wrong in this code.

decoration: new BoxDecoration(
    image: new DecorationImage(image: new Image.network("http://myurl.com/"+productList[index].thumbnail),
    fit: BoxFit.cover)
),

推荐答案

我已经解决了该问题,可以使用此代码实现.

I've resolved the issue, it can be achieved using this code.

decoration: BoxDecoration(
      image: DecorationImage(image: NetworkImage("urlImage"),
      fit: BoxFit.cover)
    ),

这篇关于如何在Flutter BoxDecoration中显示来自网络的图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-22 22:44