【问题标题】:how to show CircularProgressIndicator while loading Image.file in flutter如何在颤动中加载 Image.file 时显示 CircularProgressIndicator
【发布时间】:2021-11-24 10:45:47
【问题描述】:

这是我们在从网络 (URL) 加载图像时显示 CircularProgressIndicator 的方式。想知道如果图像文件是本地的,我们如何做类似的事情

CachedNetworkImage(
   placeholder: (context, url) => CircularProgressIndicator(),
   imageUrl:'https://www.yourdomain.com/xyz.png',
)

【问题讨论】:

    标签: image flutter file


    【解决方案1】:

    这应该可以解决问题:

    return Container(
          child: FutureBuilder(
            future: Future.delayed(Duration(seconds: 3)),
            builder: (c, s) => s.connectionState == ConnectionState.done
                ? Image.asset("assets/aem.png")
                : CircularProgressIndicator(),
          ),
        );
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-06-05
      • 2019-07-08
      • 2019-08-07
      • 2018-10-18
      • 2020-06-24
      • 2019-01-23
      相关资源
      最近更新 更多