From this question I am using Flutter's SVG package (flutter_svg
) to render a SVG image.
I want to use the SVG as a Container
background with Text
in the middle.
This is the code I have so far:
Container(
decoration: BoxDecoration(
image: DecorationImage(image: SvgPicture.asset(
'assets/example.svg',
),),
),
children: <Widget>[
Text('Welcome to my Flutter App',
style: Theme.of(context).textTheme.display1.copyWith(
color: Colors.white,
fontWeight: FontWeight.bold
)
),
],
)
The problem I am finding is that SvgPicture
is not an ImageProvider
so I can't add the BoxDecoration
to get a background image.
Is there a way to then use SvgPicture
as a Container's box decoration or background?