I want to position my object on top right corner in a stack. This is what I have. I know if I set all(LTRB) to 0.0 the image is placed in the center. Is there a simpler way for me to place the image on the upper right corner ?
Widget _buildRemoveIcon()
{
return Positioned(
top:0.0,
left:60.0,
right: 0.0,
bottom:0.0,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: new IconButton(
icon: Icon(
Icons.cancel,
color: Colors.red,
),
onPressed: () {
}), //
),
);
}
You can use the Align
widget:
Align(
alignment: Alignment.topRight,
child: ...
);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.