Home > Back-end >  SvgPictures.asset not filling the container
SvgPictures.asset not filling the container

Time:08-16

I was trying to use SvgPictures.asset as a background for my container, yet it doesnt fill it, the black part is the container itself with Colors.black while the orange part is the svg Any idea why is it like this?

Container(
                        height: 100,
                        width: MediaQuery.of(context).size.width,
                        color: Colors.black,
                        alignment: Alignment.center,
                        child: SvgPicture.asset(
                          'assets/images/title-bg.svg',
                          fit: BoxFit.cover,
                        ),
                      ),

SVGPicture

CodePudding user response:

You can use fit parameters for your case. It can be BoxFit.cover or fit: BoxFit.fill

SvgPicture.asset(
  "",
  fit: BoxFit.cover,
),

You can find more about BoxFit

CodePudding user response:

  • You can use BoxFit.fill parameters.

    SvgPicture.asset('assets/images/title-bg.svg',fit: BoxFit.fill,),

  • Related