flutter:导入图片到项目中并使用
一,创建目录并复制图片到目录下
如图:

二,编辑pubspec.yaml,把图片路径写入

三,代码中调用
body: Center(
child:Container(
child: Image.asset(
"images/b.png",
repeat: ImageRepeat.noRepeat,
fit: BoxFit.contain,
color: Colors.transparent,
colorBlendMode: BlendMode.colorDodge,
),
width: Width,
height: 300,
color: Colors.black,
),
),
四,测试效果:

浙公网安备 33010602011771号