我有一些麻烦,当我想在我的个人资料图片上移动图标按钮我只是想把它移动到图片的右下角使用堆栈这里有一些PIC我想把图像按钮移动到我放的绿色圆圈上这是我写的代码
Center(
child: Column(
children: <Widget>[
Stack(
children: [
Container(
margin: EdgeInsets.only(bottom: defaultSize),
height: defaultSize * 15,
width: defaultSize * 15,
decoration: BoxDecoration(
shape: BoxShape.circle,
border: Border.all(
color: Colors.white, width: defaultSize * 0.5),
image: DecorationImage(
fit: BoxFit.cover,
image: NetworkImage(
'https://th.bing.com/th/id/OIP.1FbFcWycnyeemiMMsoIJ7gHaF7?w=182&h=145&c=7&r=0&o=5&dpr=1.25&pid=1.7'),
),
),
child: Positioned(
right: 0,
bottom: 0,
child: Container(
child: IconButton(
onPressed: () {}, icon: Icon(Icons.image)),
)),
),
],
),
Text("Nama Kamu Siapa ")
],
错误:您的定位小部件是容器的子组件。
你必须让它成为堆栈的子节点:
Stack(
children: [
Container(
height: 100,
width: 100,
decoration: BoxDecoration(
shape: BoxShape.circle,
image: DecorationImage(
fit: BoxFit.cover,
image: NetworkImage(
'https://th.bing.com/th/id/OIP.1FbFcWycnyeemiMMsoIJ7gHaF7?w=182&h=145&c=7&r=0&o=5&dpr=1.25&pid=1.7'),
),
),
),
Positioned(
right: 0,
bottom: 0,
child: Icon(Icons.image)),
],
)