svg method

SvgPicture svg({
  1. Key? key,
  2. bool matchTextDirection = false,
  3. AssetBundle? bundle,
  4. String? package,
  5. double? width,
  6. double? height,
  7. BoxFit fit = BoxFit.contain,
  8. AlignmentGeometry alignment = Alignment.center,
  9. bool allowDrawingOutsideViewBox = false,
  10. WidgetBuilder? placeholderBuilder,
  11. String? semanticsLabel,
  12. bool excludeFromSemantics = false,
  13. SvgTheme? theme,
  14. ColorFilter? colorFilter,
  15. Clip clipBehavior = Clip.hardEdge,
  16. @deprecated Color? color,
  17. @deprecated BlendMode colorBlendMode = BlendMode.srcIn,
  18. @deprecated bool cacheColorFilter = false,
})

Implementation

SvgPicture svg({
  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,
  SvgTheme? theme,
  ColorFilter? colorFilter,
  Clip clipBehavior = Clip.hardEdge,
  @deprecated Color? color,
  @deprecated BlendMode colorBlendMode = BlendMode.srcIn,
  @deprecated bool cacheColorFilter = false,
}) {
  final id = pathId;
  if (id.asset)
    return SvgPicture.asset(
      id.path,
      key: key,
      matchTextDirection: matchTextDirection,
      width: width,
      height: height,
      fit: fit,
      alignment: alignment,
      allowDrawingOutsideViewBox: allowDrawingOutsideViewBox,
      placeholderBuilder: placeholderBuilder,
      semanticsLabel: semanticsLabel,
      excludeFromSemantics: excludeFromSemantics,
      colorFilter: colorFilter ??
          (color == null ? null : ColorFilter.mode(color, colorBlendMode)),
      clipBehavior: clipBehavior,
      cacheColorFilter: cacheColorFilter,
      package: package,
      bundle: bundle,
    );
  return SvgPicture.file(
    File(id.path),
    key: key,
    matchTextDirection: matchTextDirection,
    width: width,
    height: height,
    fit: fit,
    alignment: alignment,
    allowDrawingOutsideViewBox: allowDrawingOutsideViewBox,
    placeholderBuilder: placeholderBuilder,
    semanticsLabel: semanticsLabel,
    excludeFromSemantics: excludeFromSemantics,
    colorFilter: colorFilter ??
        (color == null ? null : ColorFilter.mode(color, colorBlendMode)),
    clipBehavior: clipBehavior,
    cacheColorFilter: cacheColorFilter,
  );
}