Flutter 布局与组件使用全解析
1. 内存图像的 ImageProvider
在 Flutter 中,我们可以使用 MemoryImage 类将内存中存储的图像作为 ImageProvider 使用,其使用方式如下:
MemoryImage(
bytes
)
在 Image 小部件中使用 ImageProvider 时,我们可以将 ImageProvider 作为命名参数 image 传入来创建 Image 小部件。例如:
Image(
image: NetworkImage(
"http://example.com/image.png"
),
)
同时,还可以对图像进行缩放、设置宽度、高度、重复方式等修改。对于 AssetImages 和 MemoryImages 也是如此,这有助于解释 ImageProvider 与 Image 小部件中包含的数据差异。
2. 垂直布局
当开发者需要垂直布局项目时,有两种选择: Column 和 ListView </
超级会员免费看
订阅专栏 解锁全文
18

被折叠的 条评论
为什么被折叠?



