gpt4 book ai didi

dart - 装饰图像不被BoxDecoration剪切

转载 作者:行者123 更新时间:2023-12-03 04:02:29 25 4
gpt4 key购买 nike

为什么不能在BoxDecoration父窗口小部件内剪切方形png图像?我做错了什么?

这是我的代码:

final appLogo = Hero(
tag: 'hero',
child: Container(
width: 200.0,
height: 200.0,
decoration: new BoxDecoration(
shape: BoxShape.circle,
border: Border.all(color: Colors.white, width: 1.5),
image: DecorationImage(
image: AssetImage('images/logo.png'),
fit: BoxFit.fill,
)),
),
);

.....
return Scaffold(
backgroundColor: Colors.brown.shade100,
body: Center(
child: ListView(
shrinkWrap: true,
padding: EdgeInsets.only(left: 24.0, right: 24.0),
children: <Widget>[
appLogo,
SizedBox(
height: 48,
),
emailField,
SizedBox(
height: 8.0,
),
passwordField,
SizedBox(
height: 24.0,
),
loginButton,
forgotPButton,
],
),
),
);
}
}

最佳答案

在github上有一个关于此问题的问题Add Container.clipBehavior to clip to the decoration #14421

现在,您可以使用CircleAvatar实现所需的功能。

关于dart - 装饰图像不被BoxDecoration剪切,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54305483/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com