SymbolIcon class

A wrapper widget around AssetImage which provides image icon for the given symbolCode.

This widget expects assets to be provided by the consuming application. By default, it looks for assets in the consuming app's assets folder (not in the acme_chart package).

Asset Structure

The widget expects the following asset structure in the consuming app:

assets/
  icons/
    icon_placeholder.png
    symbols/
      {symbol_code}.png

Customization

You can customize the asset paths by providing:

  • assetPathBuilder: Custom function to build symbol asset paths
  • placeholderPath: Custom path to the placeholder image
  • package: Specify a package name if assets are in a different package

Example Usage

// Using default paths (assets in consuming app)
SymbolIcon(symbolCode: 'frxeurusd')

// Using custom paths
SymbolIcon(
  symbolCode: 'frxeurusd',
  assetPathBuilder: (code) => 'custom/path/$code.png',
  placeholderPath: 'custom/placeholder.png',
)

// Using assets from a different package
SymbolIcon(
  symbolCode: 'frxeurusd',
  package: 'my_assets_package',
)
Inheritance

Constructors

SymbolIcon({Key? key, required String symbolCode, double width = 32, double height = 32, Duration fadeDuration = const Duration(milliseconds: 50), String assetPathBuilder(String)?, String? placeholderPath, String? package})
Initializes a wrapper widget around AssetImage which provides image icon for the given symbolCode.

Properties

alignment AlignmentGeometry
How to align the image within its bounds.
finalinherited
color Color?
If non-null, this color is blended with each image pixel using colorBlendMode.
finalinherited
colorBlendMode BlendMode?
Used to combine color with this image.
finalinherited
excludeFromSemantics bool
Whether to exclude this image from semantics.
finalinherited
fadeInCurve Curve
The curve of the fade-in animation for the image.
finalinherited
fadeInDuration Duration
The duration of the fade-in animation for the image.
finalinherited
fadeOutCurve Curve
The curve of the fade-out animation for the placeholder.
finalinherited
fadeOutDuration Duration
The duration of the fade-out animation for the placeholder.
finalinherited
filterQuality FilterQuality
The rendering quality of the image.
finalinherited
fit BoxFit?
How to inscribe the image into the space allocated during layout.
finalinherited
hashCode int
The hash code for this object.
no setterinherited
height double?
If non-null, require the image to have this height.
finalinherited
image ImageProvider<Object>
The target image that is displayed once it has loaded.
finalinherited
imageErrorBuilder ImageErrorWidgetBuilder?
A builder function that is called if an error occurs during image loading.
finalinherited
imageSemanticLabel String?
A semantic description of the image.
finalinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
matchTextDirection bool
Whether to paint the image in the direction of the TextDirection.
finalinherited
placeholder ImageProvider<Object>
Image displayed while the target image is loading.
finalinherited
placeholderColor Color?
If non-null, this color is blended with each placeholder image pixel using placeholderColorBlendMode.
finalinherited
placeholderColorBlendMode BlendMode?
Used to combine placeholderColor with the placeholder image.
finalinherited
placeholderErrorBuilder ImageErrorWidgetBuilder?
A builder function that is called if an error occurs during placeholder image loading.
finalinherited
placeholderFilterQuality FilterQuality?
The rendering quality of the placeholder image.
finalinherited
placeholderFit BoxFit?
How to inscribe the placeholder image into the space allocated during layout.
finalinherited
repeat ImageRepeat
How to paint any portions of the layout bounds not covered by the image.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
width double?
If non-null, require the image to have this width.
finalinherited

Methods

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