UISvgAssetIcon class

Renders an SVG asset using a lightweight custom painter.

The SVG file must be declared in the host app's or this package's pubspec.yaml assets. Social brand icons ship under packages/vvk_ui_kit/assets/icons/social/.

Example:

UISvgAssetIcon(
  assetPath: 'assets/icons/home.svg',
  size: 32,
  color: Colors.blue,
)

Capabilities & limitations

This is a lightweight SVG renderer built on the kit's own path parser — not a full flutter_svg replacement. It is tuned for simple, single-color icons (paths + basic shapes) such as brand/monochrome glyphs. Complex SVGs — gradients, masks, filters, embedded images, text nodes, or multi-color artwork — may render incorrectly or not at all.

Choosing a renderer:

  • UISvgAssetIcon — simple, uniformly tinted icons where you want zero extra dependencies.
  • UIImage + UIImageScope — everything else. Wire a flutter_svg (or cached_network_image) builder through UIImageScope so UIImage handles complex/remote SVGs, caching, and error states consistently.
Inheritance

Constructors

UISvgAssetIcon({Key? key, required String assetPath, double size = 24, Color? color})
Creates a UISvgAssetIcon.
const

Properties

assetPath String
Path to the SVG asset in the host application.
final
color Color?
Color to tint the SVG path.
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
size double
Width and height of the icon.
final

Methods

build(BuildContext context) Widget
Describes the part of the user interface represented by this widget.
override
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.
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