ImageWidget class
封装图片加载控件,增加图片加载失败时加载默认图片
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- ImageWidget
Constructors
-
ImageWidget({Key? key, required ImageProvider<
Object> image, ImageFrameBuilder? frameBuilder, ImageLoadingBuilder? loadingBuilder, ImageErrorWidgetBuilder? errorBuilder, String? semanticLabel, bool excludeFromSemantics = false, required double width, required double height, Color? color, Animation<double> ? opacity, BlendMode? colorBlendMode, required BoxFit fit, AlignmentGeometry alignment = Alignment.center, ImageRepeat repeat = ImageRepeat.noRepeat, Rect? centerSlice, bool matchTextDirection = false, bool gaplessPlayback = false, bool isAntiAlias = false, FilterQuality filterQuality = FilterQuality.low, required String? src, Widget? errorWidget, Widget? loadingWidget, int? cacheWidth, int? cacheHeight, String? assetUrl}) -
const
-
ImageWidget.asset(String? assetUrl, {Key? key, AssetBundle? bundle, ImageFrameBuilder? frameBuilder, ImageErrorWidgetBuilder? errorBuilder, String? semanticLabel, bool excludeFromSemantics = false, double? scale, required double width, required double height, Color? color, Animation<
double> ? opacity, BlendMode? colorBlendMode, BoxFit fit = BoxFit.none, AlignmentGeometry alignment = Alignment.center, ImageRepeat repeat = ImageRepeat.noRepeat, Rect? centerSlice, bool matchTextDirection = false, bool gaplessPlayback = false, bool isAntiAlias = false, String? package, FilterQuality filterQuality = FilterQuality.low, int? cacheWidth, int? cacheHeight, String? src, Widget? errorWidget, Widget? loadingWidget}) -
ImageWidget.network(String? src, {Key? key, required double width, required double height, double scale = 1.0, Widget? errorWidget, BoxFit fit = BoxFit.none, Widget? loadingWidget, ImageFrameBuilder? frameBuilder, ImageLoadingBuilder? loadingBuilder, ImageErrorWidgetBuilder? errorBuilder, String? semanticLabel, bool excludeFromSemantics = false, Color? color, Animation<
double> ? opacity, BlendMode? colorBlendMode, AlignmentGeometry alignment = Alignment.center, ImageRepeat repeat = ImageRepeat.noRepeat, Rect? centerSlice, bool matchTextDirection = false, bool gaplessPlayback = false, FilterQuality filterQuality = FilterQuality.low, bool isAntiAlias = false, Map<String, String> ? headers, int? cacheWidth, String? assetUrl, int? cacheHeight})
Properties
- alignment → AlignmentGeometry
-
final
- assetUrl → String?
-
本地图片地址
final
- cacheHeight → int?
-
final
- cacheWidth → int?
-
final
- centerSlice → Rect?
-
final
- color → Color?
-
final
- colorBlendMode → BlendMode?
-
final
- errorBuilder → ImageErrorWidgetBuilder?
-
final
- errorWidget → Widget?
-
加载错误时展示Widget
final
- excludeFromSemantics → bool
-
final
- filterQuality → FilterQuality
-
final
- fit → BoxFit
-
适配样式
final
- frameBuilder → ImageFrameBuilder?
-
final
- gaplessPlayback → bool
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- height → double
-
图片高度
final
-
image
→ ImageProvider<
Object> -
以下系统Image属性,释义请参考系统Image中注释
final
- isAntiAlias → bool
-
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- loadingBuilder → ImageLoadingBuilder?
-
final
- loadingWidget → Widget?
-
加载中展示Widget
final
- matchTextDirection → bool
-
final
-
opacity
→ Animation<
double> ? -
final
- repeat → ImageRepeat
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- semanticLabel → String?
-
final
- src → String?
-
图片地址
final
- width → double
-
图片宽度
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< StatefulWidget> -
Creates the mutable state for this widget at a given location in the tree.
override
-
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, int wrapWidth = 65}) → 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