Flutter 组件 Image
xxxixxxx

Image 本地图片

1
2
3
Image(
image: Assets.images.cat,
)

Image.network 显示网络图片

1
2
3
4
5
6
7
8
Image.network(
'图片url',
//充满不变形
fit: BoxFit.cover,
alignment: Alignment.center,
color: Colors.blueGrey,
colorBlendMode: BlendMode.difference,
)

结合 ClipOval 组件 展示圆图

1
2
3
4
5
6
7
8
9
ClipOval(
clipBehavior: Clip.antiAliasWithSaveLayer,
child: Image.network(
imageUrl,
// width: 200,
// height: 200,ß
fit: BoxFit.cover,
),
);

Container BoxDecoration 属性生成 圆图

1
2
3
4
5
6
7
8
9
10
11
12
Container(
// child: networkImage,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(150),
image: DecorationImage(
image: NetworkImage(imageUrl),
fit: BoxFit.cover,
),
),
width: 300,
height: 300,
);
  • Post title:Flutter 组件 Image
  • Post author:xxxixxxx
  • Create time:2020-12-28 14:20:00
  • Post link:https://xxxixxx.github.io/2020/12/28/400-Flutter组件Image/
  • Copyright Notice:All articles in this blog are licensed under BY-NC-SA unless stating additionally.
 Comments