gpt4 book ai didi

image - 将图像堆叠在两个小部件中( flutter )

转载 作者:行者123 更新时间:2023-12-03 03:23:08 26 4
gpt4 key购买 nike

我的目标是像这样创造

enter image description here

我希望我的图像显示在白色的大容器和背景中

我试图做到这一点

        Stack(
overflow: Overflow.clip,
alignment: AlignmentDirectional.topCenter,
fit: StackFit.loose,
children: <Widget>[


Container(
height: 458.4,
width: double.infinity,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(20),
topRight: Radius.circular(20)
)
),
),

GFAvatar(
backgroundImage:AssetImage(url),
shape: GFAvatarShape.standard,
radius: 70,
borderRadius: BorderRadius.circular(20),
)
],
),
]

并且无法正常工作,只能将其堆叠在容器中

最佳答案

尝试在Positioned中使用Stack并使溢出的Overflow.visible

Stack(
overflow: Overflow.visible,
alignment: AlignmentDirectional.topCenter,
fit: StackFit.loose,
children: <Widget>[
Container(
height: 400.4,
width: double.infinity,
decoration: BoxDecoration(
color: Colors.amberAccent,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(20),
topRight: Radius.circular(20))),
),
Positioned(
top: -50,
child: CircleAvatar(
radius: 50,
backgroundImage:
NetworkImage('https://picsum.photos/250?image=2'),
),
)
],
)

关于image - 将图像堆叠在两个小部件中( flutter ),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60978347/

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