**How can i stretch svg image ?
the code is:**
child: SvgPicture.asset(
'assets/images/accessories.svg',
height: constraints.maxHeight * 0.5,
width: constraints.maxWidth * 0.8,
),
You can use the fit property for SvgPicture widget to provide the fitting on the asset image according to need. Some of the properties for fit are
As large as possible while still containing the source entirely within the target box.
As small as possible while still covering the entire target box.
Fill the target box by distorting the source's aspect ratio.
Make sure the full height of the source is shown, regardless of whether this means the source overflows the target box horizontally.
Make sure the full width of the source is shown, regardless of whether this means the source overflows the target box vertically.
Align the source within the target box (by default, centering) and discard any portions of the source that lie outside the box.
As large as possible while still containing the source entirely within the target box.
For more detailed reference see official documentation
You can use the fit property for the SvgPicture widget this way below.
Widget build(BuildContext context) {
return Container(
child: Stack(
children: [
FittedBox(
fit: BoxFit.cover,
child: SvgPicture.asset('assets/icons/bg.svg'),
),
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With