-
project目录下新建文件夹,并导入图片,如下
images
-
在project目录下找到文件pubspec.yaml
pubspec.yaml
-
pubspec.yaml文件中找到 # assets:行,按照示例在下面配置asset路径
配置asset路径
-
在代码中使用
return Container(
child: Image.asset('images/testImg.png'),
);
在project目录下找到文件pubspec.yaml
pubspec.yaml文件中找到 # assets:行,按照示例在下面配置asset路径
在代码中使用
return Container(
child: Image.asset('images/testImg.png'),
);
本文标题:flutter本地图片使用
本文链接:https://www.haomeiwen.com/subject/alnnkqtx.html
网友评论