目录导航
Image
Image
是用来显示图片的widget
,类似android
中的ImageView
。看一下它的构造方法:
const Image({
Key key,
@required this.image,
this.semanticLabel,
this.excludeFromSemantics = false,
this.width,
this.height,
this.color,
this.colorBlendMode,
this.fit,
this.alignment = Alignment.center,
this.repeat = ImageRepeat.noRepeat,
this.centerSlice,
this.matchTextDirection = false,
this.gaplessPlayback = false,
this.filterQuality = FilterQuality.low,
}) : assert(image != null),
assert(alignment != null),
assert(repeat != null),
assert(filterQuality != null),
assert(matchTextDirection != null),
super(key: key);
ImageProvider
final ImageProvider image;
image
属性为ImageProvider
类型,负责提供要显示的图片。常见的ImageProvider
的有:
AssetImage
加载Asset图片NetworkImage
加载网络图片FileImage
从本地文件系统加载图片MemoryImage
从内存中加载图片