i have some trouble when i want to moving iconbutton on my profile picture i just want to move it on right bottom of picture using stack heres some pic that i have try i want to move the image button on green circle that i put and this is my writted code
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 ")
],
CodePudding user response:
The error : your Positioned Widget is the child of the Container.
You have to make it a child of the stack :
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)),
],
)