Flutter SVG rendering - how to paint image - flutter

I am testing the use of undraw library assets in my flutter app.
I am using the flutter_svg plugin and I am able to display the file properly using the following code
final Widget svg = SvgPicture.asset('assets/image.svg');
Now I would like to paint the SVG and I see there is a color and colorBlenMode property.
The problem is that if I set the color then my whole image gets painted. I actually would like to paint only a layer as per the image below.
Does anyone know if it is at all possible? How could I do it?

Maybe you can solve it doing a SVG by yourself on Method Draw, you can draw and paint each component as you want, after that you can convert your SVG code to a Flutter Custom Painter which is basically a draw in flutter, Flutter Shape Maker.

Related

Flutter Web - Image Painted with Color Filter to Become Invisible No Longer Works After Upgrading Flutter to 3.7.1

Have raw image pngs which are all white in colour which, upon loading in a Flutter app, are each painted with specific Paints to form composites of various different colours.
One of the Paints acts as an invisible paint so that we can have specific images in the composites to show/not show according to runtime conditions.
This trick works fine when Flutter version 3.3.9 is used but now, we have upgraded to Flutter version 3.7.1 and the invisible Paint trick in our composites no longer works.
To be specific, it no longer works when run on Chrome Web browser (i.e. flutter web). The invisible Paint trick still works as expected in Flutter native mobile app.
Invisible Paint we define as follows:
// Invisible Paint
static final Paint invisiblePaint = Paint()
..colorFilter = const ColorFilter.mode(Color(0x00000000), BlendMode.modulate);
When we paint the images to become invisible we paint them on Canvas as follows:
canvas.drawImage(image, Offset.zero, invisiblePaint);
When run using Flutter 3.7.1 on Chrome Web Browser the image remains white as in the raw image png as though the invisible paint is being laid on top of the raw image's white pixels instead of replacing the pixel colours altogether.
Any ideas why this no longer works in Flutter stable version 3.7.1?
I was able to make the raw images invisible when run in Chrome web browser using Flutter stable 3.7.1 by redefining the invisible Paint just to use a Color instead of a ColorFilter as follows:
// Invisible Paint
static final Paint invisiblePaint = Paint()..color = const Color(0x00000000));
With invisible Paint defined like this the code behaves as expected in both Chrome web browser app as well as native mobile app.
It should be noted however that in cases where the raw white images need to be painted an actual colour then the Paints still need to use ColorFilters.
I don't know enough about the ins and outs of Flutter ui.Image renderings using Paint Colors/ColorFilters to explain why it works one way but not the other or why the problem was only being seen in flutter web but not flutter native mobile app.

Is there a way to display animated SVG with flutter?

I am trying to display an animated SVG on Flutter,
this SVG itself contain animations, I don't want to animated from outside using an other library, if I try to apply SvgPicture.asset() to show it, it bring it without any animation.
Flutter currently doesn't provide any SVG support directly.
You can use https://pub.dartlang.org/packages/flutter_svg for basic SVG support
and Lottie or Fluttie for animated vector graphics.

How to zoom in SVG picture freely in Flutter

I am using flutter_svg package to show svg picture in flutter but I want to be able to zoom into this picture without losing the svg properties of keeping the resolution, I have tried to use photo_view for zooming capabilities and flutter_svg_provider to use svg picture as image provider but it's not working properly.
So is there a way to be able to zoom and move freely in SVG picture in Flutter?

How to add image on canvas using Render object in flutter?

I want to add image on canvas(color:White) using Render object in flutter.
Initially I want the canvas to be white in color and Rectangular in shape.
After I load an image, That image should be in top canvas.
I dont know how to do it.Please help me to do this.

Can we build an Image Editor in Flutter?

How can I make an Image Editor app in Flutter, adding a frame to an image an emojis and after that saving it to local storage, any tutorial or idea?
I tried using CustomPainter + render to texture but didn't get it how it can solve my problem