svg method

SvgPicture svg(
  1. String assetPath, {
  2. Key? key,
  3. bool matchTextDirection = false,
  4. AssetBundle? bundle,
  5. String? package,
  6. double? width,
  7. double? height,
  8. BoxFit fit = BoxFit.contain,
  9. Alignment alignment = Alignment.center,
  10. bool allowDrawingOutsideViewBox = false,
  11. Widget placeholderBuilder(
    1. BuildContext
    )?,
  12. String? semanticsLabel,
  13. bool excludeFromSemantics = false,
  14. Clip clipBehavior = Clip.hardEdge,
  15. SvgTheme theme = const SvgTheme(),
  16. ColorFilter? colorFilter,
})

引数のアセットパスと幅/高さのサイズ指定を元に SvgPicture(flutter_svg)形式で返す 例: svg( 'assets/images/svg.svg', width: 128, height: 128, )

Implementation

SvgPicture svg(
  String assetPath, {
  Key? key,
  bool matchTextDirection = false,
  AssetBundle? bundle,
  String? package,
  double? width,
  double? height,
  BoxFit fit = BoxFit.contain,
  Alignment alignment = Alignment.center,
  bool allowDrawingOutsideViewBox = false,
  Widget Function(BuildContext)? placeholderBuilder,
  String? semanticsLabel,
  bool excludeFromSemantics = false,
  Clip clipBehavior = Clip.hardEdge,
  SvgTheme theme = const SvgTheme(),
  ColorFilter? colorFilter,
}) {
  return SvgPicture.asset(
    assetPath,
    key: key,
    matchTextDirection: matchTextDirection,
    bundle: bundle,
    package: package,
    width: width,
    height: height,
    fit: fit,
    alignment: alignment,
    allowDrawingOutsideViewBox: allowDrawingOutsideViewBox,
    placeholderBuilder: placeholderBuilder,
    semanticsLabel: semanticsLabel,
    excludeFromSemantics: excludeFromSemantics,
    clipBehavior: clipBehavior,
    theme: theme,
    colorFilter: colorFilter,
  );
}