2、FlutterAssetsGenerator
介绍地址:https://juejin.cn/post/6898542896274735117
配置assets目录
插件会从pubspec.yaml
文件下读取assets目录,因此要使用本插件,你需要在pubspec.yaml
下配置资源目录
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
# To add assets to your application, add an assets section, like this:
assets:
- assets/images/
注意1:图片拖动或者粘贴到asstes/images/目录下就会触发在指定文件自动生成对应的图片路径
Image.asset(
Assets.imagesAdd,
width: 40,
height: 40,
)
注意2:如果是在module中用这个插件,需要增加传递module名字参数
手动触发生成图片路径操作如下文章来源:https://www.toymoban.com/news/detail-691833.html
文章来源地址https://www.toymoban.com/news/detail-691833.html
到了这里,关于flutter plugins插件【二】【FlutterAssetsGenerator】的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!