美文网首页
flutter本地图片使用

flutter本地图片使用

作者: 老P打码 | 来源:发表于2018-12-23 19:06 被阅读0次
    • project目录下新建文件夹,并导入图片,如下 images
    • 在project目录下找到文件pubspec.yaml


      pubspec.yaml
    • pubspec.yaml文件中找到 # assets:行,按照示例在下面配置asset路径


      配置asset路径
    • 在代码中使用

    return Container(
      child: Image.asset('images/testImg.png'),
    );
    

    相关文章

      网友评论

          本文标题:flutter本地图片使用

          本文链接:https://www.haomeiwen.com/subject/alnnkqtx.html