如何使Stack的一个元素出现在另一个元素之外



这是一个直观解释的问题,我试图使用Stack小部件将文本小部件堆叠在放置在中心的圆形化身上。当我尝试使用Positioned小部件将其放在底部时,文本小部件似乎被剪切了;就在圆圈外的阿凡达。

Stack(
children: <Widget>[
// circle avatar has to be on the center
CircleAvatar(
radius: 40, //making the border of circleAvatar appear amber colored
backgroundColor: Colors.amber[900],
child: CircleAvatar(
// backgroundImage:
//     AssetImage('assets/images/img1.png'),
radius: 38,
),
),
// this has to be on the right near the  circle avatar on the same row
Positioned(
bottom: 0,
right: 0,
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Text('Dummytext1'),
SizedBox(
height: 5,
width: 5,
),
Text('dummytext2')
],
),
),
]),

将clipBehavior添加到堆栈

Stack(
clipBehaviour: Clip.none,
children: <Widget>[
]
),

这将强制它不剪辑任何溢出的内容

相关内容

最新更新