ScalableImageWidget constructor

ScalableImageWidget({
  1. Key? key,
  2. required ScalableImage si,
  3. BoxFit fit = BoxFit.contain,
  4. Alignment alignment = Alignment.center,
  5. bool clip = true,
  6. double scale = 1,
  7. Color? background,
  8. bool isComplex = false,
  9. ExportedIDLookup? lookup,
})

Create a widget to display a pre-loaded ScalableImage. This is the preferred constructor, because the widget can display the SI immediately. It does, however, place responsibility for any asynchronous loading on the caller.

If the ScalableImage contains embedded images, it is recommended that the caller await a call to ScalableImage.prepareImages() before creating the widget. See also ScalableImage.unprepareImages(). If this is not done, there might be a delay after the widget is created while the image(s) are decoded.

fit controls how the scalable image is scaled within the widget. If fit does not control scaling, then scale is used.

alignment sets the alignment of the scalable image within the widget.

clip, if true, will cause the widget to enforce the boundaries of the scalable image.

background, if provided, will be the background color for a layer under the SVG asset. In relatively rare circumstances, this can be needed. For example, browsers generally render an SVG over a white background, which affects advanced use of the mix-blend-mode attribute applied over areas without other drawing.

isComplex see ScalableImageWidget.isComplex

lookup is used to look up node IDs that were exported in an SVG asset. See ExportedIDLookup.

Implementation

factory ScalableImageWidget(
        {Key? key,
        required ScalableImage si,
        BoxFit fit = BoxFit.contain,
        Alignment alignment = Alignment.center,
        bool clip = true,
        double scale = 1,
        Color? background,
        bool isComplex = false,
        ExportedIDLookup? lookup}) =>
    _SyncSIWidget(
        key, si, fit, alignment, clip, scale, background, isComplex, lookup);