SvgPicture.network constructor

SvgPicture.network(
  1. String url, {
  2. Key? key,
  3. Map<String, String>? headers,
  4. double? width,
  5. double? height,
  6. BoxFit fit = BoxFit.contain,
  7. AlignmentGeometry alignment = Alignment.center,
  8. bool matchTextDirection = false,
  9. bool allowDrawingOutsideViewBox = false,
  10. WidgetBuilder? placeholderBuilder,
  11. ColorFilter? colorFilter,
  12. @deprecated Color? color,
  13. @deprecated BlendMode colorBlendMode = ui.BlendMode.srcIn,
  14. String? semanticsLabel,
  15. bool excludeFromSemantics = false,
  16. Clip clipBehavior = Clip.hardEdge,
  17. @deprecated bool cacheColorFilter = false,
  18. SvgTheme? theme,
  19. Client? httpClient,
})

Creates a widget that displays an SVG obtained from the network.

The url argument must not be null.

Either the width and height arguments should be specified, or the widget should be placed in a context that sets tight layout constraints. Otherwise, the image dimensions will change as the image is loaded, which will result in ugly layout changes.

If matchTextDirection is set to true, the picture will be flipped horizontally in TextDirection.rtl contexts.

The allowDrawingOutsideOfViewBox parameter should be used with caution - if set to true, it will not clip the canvas used internally to the view box, meaning the picture may draw beyond the intended area and lead to undefined behavior or additional memory overhead.

A custom placeholderBuilder can be specified for cases where decoding or acquiring data may take a noticeably long time, such as high latency scenarios.

The color and colorBlendMode arguments, if specified, will be used to set a ColorFilter on any Paints created for this drawing.

The theme argument, if provided, will override the default theme used when parsing SVG elements.

All network images are cached regardless of HTTP headers.

An optional headers argument can be used to send custom HTTP headers with the image request.

If excludeFromSemantics is true, then semanticsLabel will be ignored.

Implementation

SvgPicture.network(
  String url, {
  Key? key,
  Map<String, String>? headers,
  this.width,
  this.height,
  this.fit = BoxFit.contain,
  this.alignment = Alignment.center,
  this.matchTextDirection = false,
  this.allowDrawingOutsideViewBox = false,
  this.placeholderBuilder,
  ui.ColorFilter? colorFilter,
  @deprecated ui.Color? color,
  @deprecated ui.BlendMode colorBlendMode = ui.BlendMode.srcIn,
  this.semanticsLabel,
  this.excludeFromSemantics = false,
  this.clipBehavior = Clip.hardEdge,
  @deprecated bool cacheColorFilter = false,
  SvgTheme? theme,
  http.Client? httpClient,
})  : bytesLoader = SvgNetworkLoader(
        url,
        headers: headers,
        theme: theme,
        httpClient: httpClient,
      ),
      colorFilter = colorFilter ?? _getColorFilter(color, colorBlendMode),
      super(key: key);