如何拉伸SVG图片?
以下是代码:
child: SvgPicture.asset(
'assets/images/accessories.svg',
height: constraints.maxHeight * 0.5,
width: constraints.maxWidth * 0.8,
),
如何拉伸SVG图片?
以下是代码:
child: SvgPicture.asset(
'assets/images/accessories.svg',
height: constraints.maxHeight * 0.5,
width: constraints.maxWidth * 0.8,
),
通过扭曲源的宽高比填充目标框。
将源文本与目标框内对齐(默认为居中),并丢弃超出框外的任何部分。
尽可能大,同时完整地包含源代码在目标框内。
更详细的参考请查看官方文档
Widget build(BuildContext context) {
return Container(
child: Stack(
children: [
FittedBox(
fit: BoxFit.cover,
child: SvgPicture.asset('assets/icons/bg.svg'),
),