I cannot figure out how to set background image of container using svg picture !
I tried setting image as background but it didnt work
that method works with asset images or online images but is not successfully working with svg pictures
i am using svg.picture .
I am noobie !
5
Answers
To use an SVG as the background of a container in Flutter, you can use the
DecoratedBox
along with theSvgPicture.asset
widget.Here is an example:
I haven’t test it, I’m not sure if it works. If you get any error just tell me!
I’m trying to Solve your Problem:
Code:
You can use the flutter_svg package to display the svg image.
Instead of using it as background image, i suggest you to use
Stack
to stack the svg image in the back and your widget in the front.Example
You can use SVG as
Container's child
or If you need just for background then useStack
:Please use
svg_provider
package for the same. You might have to set flutter_svg version to ^1.0.1 to make it work.