Skip to content

Using SVG images #12

Description

@quangll-Dawn

Hi @marcglasberg ,
First of all, thanks for the amazing package, it's helped me a lot. I can use img.pixelColorAt() to get color from 1 point in the image
But now I must use svg image as my input and it doesn't work

    Widget flutter = SvgPicture.asset(AssetHelper.gioviet); //this is svg image link
    ImageProvider flutterImageProvider = flutter as ImageProvider;
    Offset localPosition = const Offset(10, 10);
    return ImagePixels(
      imageProvider: flutterImageProvider,
      builder: (BuildContext context, ImgDetails img) {
        var color = img.pixelColorAt!(
          localPosition.dx.toInt(),
          localPosition.dy.toInt(),
        );
        Brightness brightness = ThemeData.estimateBrightnessForColor(color);
        return SizedBox(
          width: 150,
          height: 213,
          child: Column(
            children: [
              Image(image: flutterImageProvider),
              Text("Pixel color at top-left: $color."),
              Text("And brightness: $brightness."),
            ],
          ),
        );
      },
    );

Do you have any idea to solve my problem
Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions