颤音 - 如何调整拟合的容器中图像的位置:boxfit.cover
因此,我有一个显示图像的容器,并且图像拟合拟合到容器中:boxfit.cover,这是代码:
Container(
width: 80,
height: 80,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
image: DecorationImage(
fit: BoxFit.cover,
image: AssetImage(
"assets/images/MojitoImage.png"),
),
),
),
代码的结果将看起来像这样
要将图像的位置稍微改变到底部,以便看起来像这样(叶子上方有一个黑色空间)
有什么解决方案?
so i have a container that displays an image, and the image fitted to the container with fit:BoxFit.cover, here is the code:
Container(
width: 80,
height: 80,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
image: DecorationImage(
fit: BoxFit.cover,
image: AssetImage(
"assets/images/MojitoImage.png"),
),
),
),
the result of the code will looks like this
i just want to change the position of the image down a little bit to the bottom, so it can be looks like this (there is a little black space above the leaf)
any solution how to do that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试
对齐:Alignment.Topcenter
Try
alignment: Alignment.topCenter
您可以简单地将图像放置在
stack
和位置
小部件之类的位置:You can simply position the image with
Stack
andPosition
widget like this: