flutter - 即使使用小部件图像也可以加载图像
问题描述
错误是这样的
无法获取文件状态"C:\Users\gio\Desktop\flutter\TodoAppV2\assets\Magic_Menu_Image.webp": file not found.
但我无法加载它。下面是我的代码。
主要飞镖:
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Home'),
),
drawer: Drawer(
child: ListView(
padding: EdgeInsets.all(0),
children: <Widget>[
DrawerHeader(
child: null,//Image.asset('assets/Magic_Menu_Image.jpg'),
decoration: BoxDecoration(color: Colors.black),
),
ListTile(
title: Container(
color: Colors.orange[900],
child: Row(
children: <Widget>[
Icon(
Icons.home,
size: 30,
),
Text(
'Home',
style: TextStyle(fontSize: 20,),
)
]
)
),
)
]
)
),
);
} }
并且不在 pubspec.yaml 文件中:
flutter:
assets:
- assets/Magic_Menu_Image.jpg
如果有人可以帮助解决此错误。
解决方案
推荐阅读
- arduino - HC-05 模块 AT 指令模式无响应
- docker - 当我第一次尝试 docker-slim 时,它点击“OCI runtime created failed:”错误,为什么?
- php - 查询结果并显示在网页上(嵌套数组)
- vb.net - VB.NET 冒泡排序不排序
- nativescript - Nativescript 6 外部图像父级不尊重高度
- tcp - 基本的 TCP 协议问题——send() 和 recv() 会发生什么
- wordpress - Wordpress/Woo 在自定义电子邮件模板上添加标题密件抄送
- html - 如何检查速度(性能)视图引擎 [pug/ejs/html]
- php - PHP数组循环构建ul li菜单
- javascript - 如何在 NextJS /_document.js 文件中获取路径名