SvgPicture class

A widget that will parse SVG data for rendering on screen.

Inheritance
Available extensions

Constructors

SvgPicture(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.
const
SvgPicture.asset(String assetName, {Key? key, bool matchTextDirection = false, AssetBundle? bundle, String? package, double? width, double? height, BoxFit fit = BoxFit.contain, AlignmentGeometry alignment = Alignment.center, bool allowDrawingOutsideViewBox = false, WidgetBuilder? placeholderBuilder, String? semanticsLabel, bool excludeFromSemantics = false, Clip clipBehavior = Clip.hardEdge, SvgTheme? theme, ColorFilter? colorFilter, @Deprecated('Use colorFilter instead.') Color? color, @Deprecated('Use colorFilter instead.') BlendMode colorBlendMode = ui.BlendMode.srcIn, @Deprecated('This no longer does anything.') bool cacheColorFilter = false})
Instantiates a widget that renders an SVG picture from an AssetBundle.
SvgPicture.file(File file, {Key? key, double? width, double? height, BoxFit fit = BoxFit.contain, AlignmentGeometry alignment = Alignment.center, bool matchTextDirection = false, bool allowDrawingOutsideViewBox = false, WidgetBuilder? placeholderBuilder, ColorFilter? colorFilter, @Deprecated('Use colorFilter instead.') Color? color, @Deprecated('Use colorFilter instead.') BlendMode colorBlendMode = ui.BlendMode.srcIn, String? semanticsLabel, bool excludeFromSemantics = false, Clip clipBehavior = Clip.hardEdge, SvgTheme? theme, @Deprecated('This no longer does anything.') bool cacheColorFilter = false})
Creates a widget that displays an SVG obtained from a File.
SvgPicture.memory(Uint8List bytes, {Key? key, double? width, double? height, BoxFit fit = BoxFit.contain, AlignmentGeometry alignment = Alignment.center, bool matchTextDirection = false, bool allowDrawingOutsideViewBox = false, WidgetBuilder? placeholderBuilder, ColorFilter? colorFilter, @Deprecated('Use colorFilter instead.') Color? color, @Deprecated('Use colorFilter instead.') BlendMode colorBlendMode = ui.BlendMode.srcIn, String? semanticsLabel, bool excludeFromSemantics = false, Clip clipBehavior = Clip.hardEdge, SvgTheme? theme, @Deprecated('This no longer does anything.') bool cacheColorFilter = false})
Creates a widget that displays an SVG obtained from a Uint8List.
SvgPicture.network(String url, {Key? key, Map<String, String>? headers, double? width, double? height, BoxFit fit = BoxFit.contain, AlignmentGeometry alignment = Alignment.center, bool matchTextDirection = false, bool allowDrawingOutsideViewBox = false, WidgetBuilder? placeholderBuilder, ColorFilter? colorFilter, @Deprecated('Use colorFilter instead.') Color? color, @Deprecated('Use colorFilter instead.') BlendMode colorBlendMode = ui.BlendMode.srcIn, String? semanticsLabel, bool excludeFromSemantics = false, Clip clipBehavior = Clip.hardEdge, @Deprecated('This no longer does anything.') bool cacheColorFilter = false, SvgTheme? theme, Client? httpClient})
Creates a widget that displays an SVG obtained from the network.
SvgPicture.string(String string, {Key? key, double? width, double? height, BoxFit fit = BoxFit.contain, AlignmentGeometry alignment = Alignment.center, bool matchTextDirection = false, bool allowDrawingOutsideViewBox = false, WidgetBuilder? placeholderBuilder, ColorFilter? colorFilter, @Deprecated('Use colorFilter instead.') Color? color, @Deprecated('Use colorFilter instead.') BlendMode colorBlendMode = ui.BlendMode.srcIn, String? semanticsLabel, bool excludeFromSemantics = false, Clip clipBehavior = Clip.hardEdge, SvgTheme? theme, @Deprecated('This no longer does anything.') bool cacheColorFilter = false})
Creates a widget that displays an SVG obtained from a String.

Properties

alignment AlignmentGeometry
How to align the picture within its parent widget.
final
allowDrawingOutsideViewBox bool
If true, will allow the SVG to be drawn outside of the clip boundary of its viewBox.
final
bytesLoader BytesLoader
The BytesLoader used to resolve the SVG.
final
clipBehavior Clip
The content will be clipped (or not) according to this option.
final
colorFilter ColorFilter?
The color filter, if any, to apply to this widget.
final
excludeFromSemantics bool
Whether to exclude this picture from semantics.
final
fit BoxFit
How to inscribe the picture into the space allocated during layout. The default is BoxFit.contain.
final
hashCode int
The hash code for this object.
no setterinherited
height double?
If specified, the height to use for the SVG. If unspecified, the SVG will take the height of its parent.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
matchTextDirection bool
If true, will horizontally flip the picture in TextDirection.rtl contexts.
final
placeholderBuilder WidgetBuilder?
The placeholder to use while fetching, decoding, and parsing the SVG data.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
semanticsLabel String?
The Semantics.label for this picture.
final
width double?
If specified, the width to use for the SVG. If unspecified, the SVG will take the width of its parent.
final

Methods

alignment(AlignmentGeometry alignment, {Key? key, bool animate = false}) Widget

Available on Widget, provided by the StyledWidget extension

animate(Duration duration, Curve curve, {Key? key}) Widget

Available on Widget, provided by the StyledWidget extension

animated all properties before this method
aspectRatio({Key? key, required double aspectRatio}) Widget

Available on Widget, provided by the StyledWidget extension

backgroundBlendMode(BlendMode blendMode, {Key? key, bool animate = false}) Widget

Available on Widget, provided by the StyledWidget extension

backgroundBlur(double sigma, {Key? key, bool animate = false}) Widget

Available on Widget, provided by the StyledWidget extension

backgroundColor(Color color, {Key? key, bool animate = false}) Widget

Available on Widget, provided by the StyledWidget extension

backgroundGradient(Gradient gradient, {Key? key, bool animate = false}) Widget

Available on Widget, provided by the StyledWidget extension

backgroundImage(DecorationImage image, {Key? key, bool animate = false}) Widget

Available on Widget, provided by the StyledWidget extension

backgroundLinearGradient({Key? key, AlignmentGeometry begin = Alignment.centerLeft, AlignmentGeometry end = Alignment.centerRight, List<Color>? colors, List<double>? stops, TileMode tileMode = TileMode.clamp, GradientTransform? transform, bool animate = false}) Widget

Available on Widget, provided by the StyledWidget extension

backgroundRadialGradient({Key? key, AlignmentGeometry center = Alignment.center, double radius = 0.5, List<Color>? colors, List<double>? stops, TileMode tileMode = TileMode.clamp, AlignmentGeometry? focal, double focalRadius = 0.0, GradientTransform? transform, bool animate = false}) Widget

Available on Widget, provided by the StyledWidget extension

backgroundSweepGradient({Key? key, AlignmentGeometry center = Alignment.center, double startAngle = 0.0, double endAngle = pi * 2, List<Color>? colors, List<double>? stops, TileMode tileMode = TileMode.clamp, GradientTransform? transform, bool animate = false}) Widget

Available on Widget, provided by the StyledWidget extension

border({Key? key, double? all, double? left, double? right, double? top, double? bottom, Color color = const Color(0xFF000000), BorderStyle style = BorderStyle.solid, bool animate = false}) Widget

Available on Widget, provided by the StyledWidget extension

borderRadius({Key? key, double? all, double? topLeft, double? topRight, double? bottomLeft, double? bottomRight, bool animate = false}) Widget

Available on Widget, provided by the StyledWidget extension

borderRadiusDirectional({Key? key, double? all, double? topStart, double? topEnd, double? bottomStart, double? bottomEnd, bool animate = false}) Widget

Available on Widget, provided by the StyledWidget extension

boxShadow({Key? key, Color color = const Color(0xFF000000), Offset offset = Offset.zero, double blurRadius = 0.0, double spreadRadius = 0.0, bool animate = false}) Widget

Available on Widget, provided by the StyledWidget extension

build(BuildContext context) Widget
Describes the part of the user interface represented by this widget.
override
card({Key? key, Color? color, double? elevation, ShapeBorder? shape, bool borderOnForeground = true, EdgeInsetsGeometry? margin, Clip? clipBehavior, bool semanticContainer = true}) Widget

Available on Widget, provided by the StyledWidget extension

center({Key? key, double? widthFactor, double? heightFactor}) Widget

Available on Widget, provided by the StyledWidget extension

clipOval({Key? key}) Widget

Available on Widget, provided by the StyledWidget extension

clipRect({Key? key, CustomClipper<Rect>? clipper, Clip clipBehavior = Clip.hardEdge}) Widget

Available on Widget, provided by the StyledWidget extension

clipRRect({Key? key, double? all, double? topLeft, double? topRight, double? bottomLeft, double? bottomRight, CustomClipper<RRect>? clipper, Clip clipBehavior = Clip.antiAlias, bool animate = false}) Widget

Available on Widget, provided by the StyledWidget extension

constrained({Key? key, double? width, double? height, double minWidth = 0.0, double maxWidth = double.infinity, double minHeight = 0.0, double maxHeight = double.infinity, bool animate = false}) Widget

Available on Widget, provided by the StyledWidget extension

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.
override
decorated({Key? key, Color? color, DecorationImage? image, BoxBorder? border, BorderRadius? borderRadius, List<BoxShadow>? boxShadow, Gradient? gradient, BlendMode? backgroundBlendMode, BoxShape shape = BoxShape.rectangle, DecorationPosition position = DecorationPosition.background, bool animate = false}) Widget

Available on Widget, provided by the StyledWidget extension

elevation(double elevation, {Key? key, BorderRadiusGeometry borderRadius = BorderRadius.zero, Color shadowColor = const Color(0xFF000000)}) Widget

Available on Widget, provided by the StyledWidget extension

expanded({Key? key, int flex = 1}) Widget

Available on Widget, provided by the StyledWidget extension

fittedBox({Key? key, BoxFit fit = BoxFit.contain, AlignmentGeometry alignment = Alignment.center}) Widget

Available on Widget, provided by the StyledWidget extension

flexible({Key? key, int flex = 1, FlexFit fit = FlexFit.loose}) Widget

Available on Widget, provided by the StyledWidget extension

fractionallySizedBox({Key? key, AlignmentGeometry alignment = Alignment.center, double? widthFactor, double? heightFactor}) Widget

Available on Widget, provided by the StyledWidget extension

gestures({Key? key, GestureOnTapChangeCallback? onTapChange, GestureTapDownCallback? onTapDown, GestureTapUpCallback? onTapUp, GestureTapCallback? onTap, GestureTapCancelCallback? onTapCancel, GestureTapDownCallback? onSecondaryTapDown, GestureTapUpCallback? onSecondaryTapUp, GestureTapCancelCallback? onSecondaryTapCancel, GestureTapCallback? onDoubleTap, GestureLongPressCallback? onLongPress, GestureLongPressStartCallback? onLongPressStart, GestureLongPressMoveUpdateCallback? onLongPressMoveUpdate, GestureLongPressUpCallback? onLongPressUp, GestureLongPressEndCallback? onLongPressEnd, GestureDragDownCallback? onVerticalDragDown, GestureDragStartCallback? onVerticalDragStart, GestureDragUpdateCallback? onVerticalDragUpdate, GestureDragEndCallback? onVerticalDragEnd, GestureDragCancelCallback? onVerticalDragCancel, GestureDragDownCallback? onHorizontalDragDown, GestureDragStartCallback? onHorizontalDragStart, GestureDragUpdateCallback? onHorizontalDragUpdate, GestureDragEndCallback? onHorizontalDragEnd, GestureDragCancelCallback? onHorizontalDragCancel, GestureDragDownCallback? onPanDown, GestureDragStartCallback? onPanStart, GestureDragUpdateCallback? onPanUpdate, GestureDragEndCallback? onPanEnd, GestureDragCancelCallback? onPanCancel, GestureScaleStartCallback? onScaleStart, GestureScaleUpdateCallback? onScaleUpdate, GestureScaleEndCallback? onScaleEnd, GestureForcePressStartCallback? onForcePressStart, GestureForcePressPeakCallback? onForcePressPeak, GestureForcePressUpdateCallback? onForcePressUpdate, GestureForcePressEndCallback? onForcePressEnd, HitTestBehavior? behavior, bool excludeFromSemantics = false, DragStartBehavior dragStartBehavior = DragStartBehavior.start}) Widget

Available on Widget, provided by the StyledWidget extension

height(double height, {Key? key, bool animate = false}) Widget

Available on Widget, provided by the StyledWidget extension

limitedBox({Key? key, double maxWidth = double.infinity, double maxHeight = double.infinity}) Widget

Available on Widget, provided by the StyledWidget extension

neumorphism({Key? key, required double elevation, BorderRadius borderRadius = BorderRadius.zero, Color backgroundColor = const Color(0xffEDF1F5), double curve = 0.0, bool animate = false}) Widget

Available on Widget, provided by the StyledWidget extension

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
offstage({Key? key, bool offstage = true}) Widget

Available on Widget, provided by the StyledWidget extension

opacity(double opacity, {Key? key, bool animate = false, bool alwaysIncludeSemantics = false}) Widget

Available on Widget, provided by the StyledWidget extension

overflow({Key? key, AlignmentGeometry alignment = Alignment.center, double? minWidth, double? maxWidth, double? minHeight, double? maxHeight, bool animate = false}) Widget

Available on Widget, provided by the StyledWidget extension

padding({Key? key, double? all, double? horizontal, double? vertical, double? top, double? bottom, double? left, double? right, bool animate = false}) Widget

Available on Widget, provided by the StyledWidget extension

paddingDirectional({Key? key, double? all, double? horizontal, double? vertical, double? top, double? bottom, double? start, double? end, bool animate = false}) Widget

Available on Widget, provided by the StyledWidget extension

parent(Widget parent({required Widget child})) Widget

Available on Widget, provided by the StyledWidget extension

Applies a parent to a child
positioned({Key? key, double? left, double? top, double? right, double? bottom, double? width, double? height, bool animate = false}) Widget

Available on Widget, provided by the StyledWidget extension

positionedDirectional({Key? key, double? start, double? end, double? top, double? bottom, double? width, double? height, bool animate = false}) Widget

Available on Widget, provided by the StyledWidget extension

ripple({Key? key, Color? focusColor, Color? hoverColor, Color? highlightColor, Color? splashColor, InteractiveInkFeatureFactory? splashFactory, double? radius, ShapeBorder? customBorder, bool enableFeedback = true, bool excludeFromSemantics = false, FocusNode? focusNode, bool canRequestFocus = true, bool autoFocus = false, bool enable = true}) Widget

Available on Widget, provided by the StyledWidget extension

rotate({Key? key, required double angle, Offset? origin, AlignmentGeometry alignment = Alignment.center, bool transformHitTests = true, bool animate = false}) Widget

Available on Widget, provided by the StyledWidget extension

safeArea({Key? key, bool top = true, bool bottom = true, bool left = true, bool right = true}) Widget

Available on Widget, provided by the StyledWidget extension

scale({Key? key, double? all, double? x, double? y, Offset? origin, AlignmentGeometry alignment = Alignment.center, bool transformHitTests = true, bool animate = false}) Widget

Available on Widget, provided by the StyledWidget extension

scrollable({Key? key, Axis scrollDirection = Axis.vertical, bool reverse = false, bool? primary, ScrollPhysics? physics, ScrollController? controller, DragStartBehavior dragStartBehavior = DragStartBehavior.start, EdgeInsetsGeometry? padding}) Widget

Available on Widget, provided by the StyledWidget extension

semanticsLabel(String label, {Key? key}) Widget

Available on Widget, provided by the StyledWidget extension

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
transform({Key? key, required Matrix4 transform, Offset? origin, AlignmentGeometry? alignment, bool transformHitTests = true, bool animate = false}) Widget

Available on Widget, provided by the StyledWidget extension

translate({Key? key, required Offset offset, bool transformHitTests = true, bool animate = false}) Widget

Available on Widget, provided by the StyledWidget extension

width(double width, {Key? key, bool animate = false}) Widget

Available on Widget, provided by the StyledWidget extension

Operators

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

Static Properties

defaultPlaceholderBuilder WidgetBuilder
The default placeholder for a SVG that may take time to parse or retrieve, e.g. from a network location.
getter/setter pair