SvgPicture constructor
- BytesLoader bytesLoader, {
- Key? key,
- double? width,
- double? height,
- BoxFit fit = BoxFit.contain,
- AlignmentGeometry alignment = Alignment.center,
- bool matchTextDirection = false,
- bool allowDrawingOutsideViewBox = false,
- WidgetBuilder? placeholderBuilder,
- ColorFilter? colorFilter,
- String? semanticsLabel,
- bool excludeFromSemantics = false,
- Clip clipBehavior = Clip.hardEdge,
- @Deprecated('No code should use this parameter. It never was implemented properly. ' 'The SVG theme must be set on the bytesLoader.') SvgTheme? theme,
- @Deprecated('This no longer does anything.') bool cacheColorFilter = false,
Instantiates a widget that renders an SVG picture using the pictureProvider
.
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, e.g. for a network picture.
The semanticsLabel
can be used to identify the purpose of this picture for
screen reading software.
If excludeFromSemantics
is true, then semanticsLabel
will be ignored.
Implementation
const SvgPicture(
this.bytesLoader, {
super.key,
this.width,
this.height,
this.fit = BoxFit.contain,
this.alignment = Alignment.center,
this.matchTextDirection = false,
this.allowDrawingOutsideViewBox = false,
this.placeholderBuilder,
this.colorFilter,
this.semanticsLabel,
this.excludeFromSemantics = false,
this.clipBehavior = Clip.hardEdge,
@Deprecated(
'No code should use this parameter. It never was implemented properly. '
'The SVG theme must be set on the bytesLoader.')
SvgTheme? theme,
@Deprecated('This no longer does anything.') bool cacheColorFilter = false,
});