ImageLoader class
图片工具类
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
Static Methods
-
asset(
String name, {Key? key, ImageFrameBuilder? frameBuilder, ImageErrorWidgetBuilder? errorBuilder, String? semanticLabel, bool excludeFromSemantics = false, Color? color, double? scale, double? width, double? height, Animation< double> ? opacity, BoxFit? fit = BoxFit.cover, BlendMode? colorBlendMode, ImageRepeat repeat = ImageRepeat.noRepeat, AlignmentGeometry alignment = Alignment.center, Rect? centerSlice, bool matchTextDirection = false, bool isAntiAlias = false, bool gaplessPlayback = false, int? cacheWidth, int? cacheHeight, FilterQuality filterQuality = FilterQuality.medium, bool? isRe, bool circular = false, double? radius, BorderRadius? borderRadius, BoxBorder? border}) → Widget -
加载本地资源图片
name资源名称isRe是否使用特殊路径,如果为null则使用全局配置circular是否设置为圆形radius圆角半径borderRadius自定义圆角 -
cachedNetwork(
String? imageUrl, {double? width, double? height, String? placeholder, ImageErrorWidgetBuilder? errorBuilder, Alignment alignment = Alignment.center, BoxFit? fit = BoxFit.cover, BoxFit? placeholderFit = BoxFit.cover, Duration? fadeOutDuration, Duration? placeholderFadeInDuration, Duration? fadeInDuration, bool? useOldImageOnUrlChange, bool matchTextDirection = false, bool circular = false, double? radius, BorderRadius? borderRadius, BoxBorder? border}) → Widget -
加载一张网络图片并使用缓存
imageUrl网络图片的地址width图片视图宽height图片视图高placeholder加载占位图,如果为空则使用全局配置的默认占位图alignment对齐方式,默认 Alignment.centerfit网络图片的裁剪方式placeholderFit占位图片的裁剪方式fadeOutDuration淡出动画时长placeholderFadeInDuration占位图淡入动画时长fadeInDuration图片淡入动画时长useOldImageOnUrlChange是否在URL改变时使用旧图片circular是否设置为圆形radius圆角半径borderRadius自定义圆角 -
file(
String localPath, {double? size, double? width, double? height, Key? key, ImageFrameBuilder? frameBuilder, ImageErrorWidgetBuilder? errorBuilder, String? semanticLabel, bool excludeFromSemantics = false, Color? color, double? scale, Animation< double> ? opacity, BoxFit? fit = BoxFit.cover, BlendMode? colorBlendMode, ImageRepeat repeat = ImageRepeat.noRepeat, AlignmentGeometry alignment = Alignment.center, Rect? centerSlice, bool matchTextDirection = false, bool isAntiAlias = false, bool gaplessPlayback = false, int? cacheWidth, int? cacheHeight, FilterQuality filterQuality = FilterQuality.medium, String? placeholder, bool circular = false, double? radius, BorderRadius? borderRadius, BoxBorder? border}) → Widget - 加载文件图片
-
getUint8List(
String name) → Uint8List? -
imageProvider(
String name, {bool? isRe}) → ImageProvider< Object> -
获取图片提供者
name资源名称isRe是否使用特殊路径,如果为null则使用全局配置 -
local(
String name, {double? size, double? width, double? height, BoxFit? fit = BoxFit.cover, bool? isRe, bool matchTextDirection = false, bool circular = false, double? radius, BorderRadius? borderRadius, BoxBorder? border}) → Widget -
便捷方法:加载本地图片(使用全局配置)
circular是否设置为圆形radius圆角半径borderRadius自定义圆角 -
memory(
Uint8List bytes, {double? size, double? width, double? height, int? cacheWidth, int? cacheHeight, Key? key, ImageFrameBuilder? frameBuilder, ImageErrorWidgetBuilder? errorBuilder, String? semanticLabel, bool excludeFromSemantics = false, Color? color, double? scale, Animation< double> ? opacity, BoxFit? fit = BoxFit.cover, BlendMode? colorBlendMode, ImageRepeat repeat = ImageRepeat.noRepeat, AlignmentGeometry alignment = Alignment.center, Rect? centerSlice, bool matchTextDirection = false, bool isAntiAlias = false, bool gaplessPlayback = false, FilterQuality filterQuality = FilterQuality.medium, bool circular = false, double? radius, BorderRadius? borderRadius, BoxBorder? border}) → Widget -
从Uint8List数据加载图片
bytes图片的字节数据width图片视图宽height图片视图高fit图片填充方式circular是否设置为圆形radius圆角半径borderRadius自定义圆角 -
network(
String? imageUrl, {double? size, double? width, double? height, String? placeholder, BoxFit? fit = BoxFit.cover, Alignment alignment = Alignment.center, bool circular = false, double? radius, BorderRadius? borderRadius, BoxBorder? border}) → Widget -
便捷方法:加载网络图片(使用全局配置)
circular是否设置为圆形radius圆角半径borderRadius自定义圆角 -
preloadNetworkImage(
String? imageUrl, BuildContext context, ImageStreamListener? listener) → void - 预加载图片
-
setConfig(
ImageLoaderConfig config) → void - 设置全局配置