flutter - 容器以匹配来自 url 的图像高度
问题描述
我正在尝试拥有一个具有动态高度的灵活容器。我试图从容器中删除高度,但图像消失了。
这就是我现在拥有的固定高度
Container(
width: MediaQuery.of(context).size.width,
height: 400,
decoration: BoxDecoration(
color: Colors.white,
image: DecorationImage(
fit: BoxFit.contain,
image: NetworkImage(article.imageSrc),
),
),
),
解决方案
尝试这个
Container(
width: MediaQuery.of(context).size.width,
child: Image.network(article.imageSrc),
),
推荐阅读
- node.js - FacebookTokenError:无法加载 URL:此 URL 的域不包含在应用程序的域中
- java - Java Node.setTextContent((myString)) 将 < 和 > 转换为 < 和 >
- javascript - 更改 JS 中的输入,然后编辑 php 文件
- azure - 如果用户不是参与者或所有者,Azure 用户如何创建资源组?
- r - 如何查看保存为文件的 R 工作区?
- postgresql - 在 Docker 中连接到用户定义的网络
- sql - 删除 SQL 中的重复项和几乎重复项(缺失值)
- javascript - 从数组中过滤对象数组
- html - 循环遍历 Django 对象以在模板中创建图像列表
- jquery - 如何使用 jquery 为 data-form-data 和多个添加值?