ImageView class

Inheritance
Available Extensions

Constructors

ImageView(String imageUri, {Key? key, double? width, double? height, double? size, int? cacheWidth, int? cacheHeight, int? cacheSize, BoxFit? fit = BoxFit.cover, Color? color, EdgeInsets? padding, EdgeInsets? margin, String? darkImagePath, bool autoDarkMode = false, bool autoApplyKey = true, BoxDecoration? decoration, BoxDecoration? foregroundDecoration, Clip? clipBehavior = Clip.hardEdge, double? aspectRatio, BorderRadius? borderRadius, BoxShape? shape, BlendMode? colorBlendMode, Widget? errorWidget, Widget? placeholder, double? scale})
根据图片uri自动判断是使用本地加载还是远程加载
ImageView.icon(String imageUri, {Key? key, double? width, double? height, double? size, int? cacheWidth, int? cacheHeight, int? cacheSize, BoxFit? fit = BoxFit.contain, Color? color, EdgeInsets? padding, EdgeInsets? margin, String? darkImagePath, bool autoDarkMode = false, bool autoApplyKey = true, BoxDecoration? decoration, BoxDecoration? foregroundDecoration, Clip? clipBehavior = Clip.hardEdge, double? aspectRatio, BorderRadius? borderRadius, BoxShape? shape, BlendMode? colorBlendMode, Widget? errorWidget, Widget? placeholder, double? scale})
跟默认构造器的区别是icon构造器默认是BoxFit.contain
ImageView.local(String? imagePath, {Key? key, double? width, double? height, double? size, int? cacheWidth, int? cacheHeight, int? cacheSize, BoxFit? fit, Color? color, EdgeInsets? padding, EdgeInsets? margin, String? darkImagePath, bool autoDarkMode = false, bool autoApplyKey = true, BoxDecoration? decoration, BoxDecoration? foregroundDecoration, Clip? clipBehavior = Clip.hardEdge, double? aspectRatio, BorderRadius? borderRadius, BoxShape? shape, BlendMode? colorBlendMode, Widget? errorWidget, Widget? placeholder, double? scale})
const
ImageView.remote(String? imageUrl, {Key? key, double? width, double? height, double? size, int? cacheWidth, int? cacheHeight, int? cacheSize, BoxFit? fit, Color? color, Widget? errorWidget, Widget? placeholder, EdgeInsets? padding, EdgeInsets? margin, String? darkImagePath, bool autoDarkMode = false, bool autoApplyKey = true, BoxDecoration? decoration, BoxDecoration? foregroundDecoration, Clip? clipBehavior = Clip.hardEdge, double? aspectRatio, BorderRadius? borderRadius, BoxShape? shape, BlendMode? colorBlendMode, double? scale})
const

Properties

aspectRatio double?
如果不为空, 则使用AspectRatio包裹
final
autoApplyKey bool
是否自动设置图片路径为key
final
autoDarkMode bool
是否自动化暗黑模式
final
borderRadius BorderRadius?
圆角 是BoxDecoration的shortcut
final
cacheHeight int?
缓存宽高
final
cacheSize int?
缓存宽高
final
cacheWidth int?
缓存宽高
final
clipBehavior Clip?
剪裁行为
final
color Color?
颜色
final
colorBlendMode BlendMode?
颜色混合模式
final
darkImagePath String?
暗黑模式路径模式
final
decoration BoxDecoration?
背景
final
errorWidget Widget?
备用的asset image路径
final
fit BoxFit?
适应模式
final
foregroundDecoration BoxDecoration?
前景
final
hashCode int
The hash code for this object.
no setterinherited
height double?
宽高 如果同时设置了width, heightsize, 那么优先size
final
imagePath String?
本地图片路径
final
imageUrl String?
图片url
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
margin EdgeInsets?
边距
final
padding EdgeInsets?
边距
final
placeholder Widget?
占位图
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scale double?
缩放
final
shape BoxShape?
圆形还是方形
final
size double?
宽高 如果同时设置了width, heightsize, 那么优先size
final
width double?
宽高 如果同时设置了width, heightsize, 那么优先size
final

Methods

build(BuildContext context) Widget
Describes the part of the user interface represented by this widget.
override
createElement() StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

globalErrorWidget Widget?
getter/setter pair
globalPlaceholder Widget?
getter/setter pair
headers Map<String, String>
getter/setter pair
logEnable bool
getter/setter pair
suppressError bool
getter/setter pair