FSvgPicture class

A unified SVG widget that auto-selects static or animated rendering.

If animation markers are detected (<animate>, CSS animation, etc.), this widget uses AnimatedSvgPicture. Otherwise it falls back to SvgPicture.

Inheritance

Constructors

FSvgPicture.asset(String assetName, {Key? key, double? width, double? height, BoxFit fit = BoxFit.contain, AlignmentGeometry alignment = Alignment.center, bool matchTextDirection = false, AssetBundle? bundle, String? package, bool allowDrawingOutsideViewBox = false, WidgetBuilder? placeholderBuilder, ColorFilter? colorFilter, String? semanticsLabel, bool excludeFromSemantics = false, Clip clipBehavior = Clip.hardEdge, SvgErrorWidgetBuilder? errorBuilder, SvgTheme? theme, ColorMapper? colorMapper, RenderingStrategy renderingStrategy = RenderingStrategy.picture, Color? backgroundColor, double playbackRate = 1.0, bool autoPlay = true, Duration? initialTime})
Creates an auto-detected SVG from an asset.
const
FSvgPicture.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, String? semanticsLabel, bool excludeFromSemantics = false, Clip clipBehavior = Clip.hardEdge, SvgErrorWidgetBuilder? errorBuilder, SvgTheme? theme, ColorMapper? colorMapper, RenderingStrategy renderingStrategy = RenderingStrategy.picture, Color? backgroundColor, double playbackRate = 1.0, bool autoPlay = true, Duration? initialTime})
Creates an auto-detected SVG from a file.
const
FSvgPicture.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, String? semanticsLabel, bool excludeFromSemantics = false, Clip clipBehavior = Clip.hardEdge, SvgErrorWidgetBuilder? errorBuilder, SvgTheme? theme, ColorMapper? colorMapper, RenderingStrategy renderingStrategy = RenderingStrategy.picture, Color? backgroundColor, double playbackRate = 1.0, bool autoPlay = true, Duration? initialTime})
Creates an auto-detected SVG from UTF-8 bytes.
const
FSvgPicture.network(String url, {Key? key, Map<String, String>? headers, Client? httpClient, 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, SvgErrorWidgetBuilder? errorBuilder, SvgTheme? theme, ColorMapper? colorMapper, RenderingStrategy renderingStrategy = RenderingStrategy.picture, Color? backgroundColor, double playbackRate = 1.0, bool autoPlay = true, Duration? initialTime})
Creates an auto-detected SVG from the network.
const
FSvgPicture.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, String? semanticsLabel, bool excludeFromSemantics = false, Clip clipBehavior = Clip.hardEdge, SvgErrorWidgetBuilder? errorBuilder, SvgTheme? theme, ColorMapper? colorMapper, RenderingStrategy renderingStrategy = RenderingStrategy.picture, Color? backgroundColor, double playbackRate = 1.0, bool autoPlay = true, Duration? initialTime})
Creates an auto-detected SVG from a raw SVG string.
const

Properties

alignment AlignmentGeometry
How to align the picture within its parent widget.
final
allowDrawingOutsideViewBox bool
Whether to allow drawing outside the viewBox bounds.
final
autoPlay bool
Whether animation should start automatically.
final
backgroundColor Color?
Background color for animated rendering.
final
clipBehavior Clip
Clip behavior for static rendering.
final
colorFilter ColorFilter?
Color filter to apply to rendered output.
final
colorMapper ColorMapper?
Color substitution mapper for static rendering.
final
errorBuilder SvgErrorWidgetBuilder?
Error widget builder for source loading/parsing failures.
final
excludeFromSemantics bool
Whether to exclude this picture from semantics.
final
fit BoxFit
How to inscribe the picture into the space allocated during layout.
final
hashCode int
The hash code for this object.
no setterinherited
height double?
The height of the rendered SVG.
final
initialTime Duration?
Initial animation time for animated rendering.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
matchTextDirection bool
Flips picture horizontally in RTL contexts.
final
placeholderBuilder WidgetBuilder?
Placeholder while source is loading.
final
playbackRate double
Animated playback speed multiplier.
final
renderingStrategy → RenderingStrategy
Static render strategy (picture or raster).
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
semanticsLabel String?
Semantics label for accessibility.
final
theme SvgTheme?
Theme used when parsing static SVG elements.
final
width double?
The width of the rendered SVG.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<FSvgPicture>
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