Img.network constructor
- String src, {
- Key? key,
- double? width,
- double? height,
- BoxFit? fit,
- double scale = 1.0,
- AlignmentGeometry alignment = Alignment.center,
- Repeat repeat = Repeat.noRepeat,
- Offset mirrorOffset = Offset.zero,
- Color? color,
- BlendMode? colorBlendMode,
- Rect? centerSlice,
- bool matchTextDirection = false,
- bool gaplessPlayback = false,
- bool isAntiAlias = false,
- FilterQuality filterQuality = FilterQuality.low,
- String? semanticLabel,
- bool excludeFromSemantics = false,
- Map<
String, String> ? headers, - int? cacheWidth,
- int? cacheHeight,
- ImageFrameBuilder? frameBuilder,
- ImageLoadingBuilder? loadingBuilder,
- ImageErrorWidgetBuilder? errorBuilder,
A StatefulWidget that renders an image from a web server defined by the
URL src
,
the required String
at the front of this constructor.
This image Widget
supports an expanded concept of ImageRepeat
defined
as Repeat.
Thus this ImageToo
can render an image smaller than its
bounds by mirror-tiling with
Repeat.mirror as well as the expected values such as Repeat.noRepeat,
Repeat.repeat, etc.
For convenience, consider StringToTexture. It is used by calling one of
the three methods
(one each for Repeat.mirror, Repeat.mirrorX, Repeat.mirrorY)
on a String
such as:
final Widget imageToo = 'https://url.to/image.png'.toSeamlessTexture();
For a const ImageToo
, construct a new ImageToo
with an ImageProvider
as the image
property.
Like all package:img
classes, alignment
is ignored and forced Alignment.center
if repeat
is set to Repeat.mirror, Repeat.mirrorX, Repeat.mirrorY.
- To align/position the seamlessly-tiling image in this situation,
employ an Offset in themirrorOffset
field. - This is a workaround for now and only aids in "aligning" a
Repeat.mirror
tiled image if it is meant to fill an entire space, shifting its edges.
Implementation
Img.network(
String src, {
Key? key,
double? width,
double? height,
BoxFit? fit,
double scale = 1.0,
AlignmentGeometry alignment = Alignment.center,
Repeat repeat = Repeat.noRepeat,
Offset mirrorOffset = Offset.zero,
Color? color,
BlendMode? colorBlendMode,
Rect? centerSlice,
bool matchTextDirection = false,
bool gaplessPlayback = false,
bool isAntiAlias = false,
FilterQuality filterQuality = FilterQuality.low,
String? semanticLabel,
bool excludeFromSemantics = false,
Map<String, String>? headers,
int? cacheWidth,
int? cacheHeight,
ImageFrameBuilder? frameBuilder,
ImageLoadingBuilder? loadingBuilder,
ImageErrorWidgetBuilder? errorBuilder,
}) : super.network(
src,
scale: scale,
key: key,
frameBuilder: frameBuilder,
loadingBuilder: loadingBuilder,
errorBuilder: errorBuilder,
semanticLabel: semanticLabel,
excludeFromSemantics: excludeFromSemantics,
width: width,
height: height,
color: color,
colorBlendMode: colorBlendMode,
fit: fit,
alignment: alignment,
repeat: repeat,
mirrorOffset: mirrorOffset,
centerSlice: centerSlice,
matchTextDirection: matchTextDirection,
gaplessPlayback: gaplessPlayback,
isAntiAlias: isAntiAlias,
filterQuality: filterQuality,
headers: headers,
cacheWidth: cacheWidth,
cacheHeight: cacheHeight,
);