颤动图像不显示
Flutter Image not displaying
我在资产 folder/images 上添加了图像。所以我正在尝试制作一个带有图像横幅的页面,这是我的代码:
Container(
height: 120,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10.0),
image: const DecorationImage(
image: AssetImage("assets/images/drive.png"),
fit: BoxFit.fill,
),
),
),
# To add assets to your application, add an assets section, like this:
资产:
- assets/images/
- images/a_dot_ham.jpeg
确保项目中图像的扩展名与您添加到资产文件夹中的图像完全相同。 (.jpeg、.jpg 或 .png)
必须检查 pubspec 文件。然后在 pubspec 文件中执行 运行 一次 pub get 命令。您仍然无法在您的应用程序中看到图像,然后转到文件 -> 使缓存无效/重新启动。
(您也可以使用 Image.asset 而不是 AssetImage。)
我在资产 folder/images 上添加了图像。所以我正在尝试制作一个带有图像横幅的页面,这是我的代码:
Container(
height: 120,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10.0),
image: const DecorationImage(
image: AssetImage("assets/images/drive.png"),
fit: BoxFit.fill,
),
),
),
# To add assets to your application, add an assets section, like this:
资产: - assets/images/
- images/a_dot_ham.jpeg
确保项目中图像的扩展名与您添加到资产文件夹中的图像完全相同。 (.jpeg、.jpg 或 .png) 必须检查 pubspec 文件。然后在 pubspec 文件中执行 运行 一次 pub get 命令。您仍然无法在您的应用程序中看到图像,然后转到文件 -> 使缓存无效/重新启动。
(您也可以使用 Image.asset 而不是 AssetImage。)