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: () {
}), //
),
);
}
Just remove the left
and bottom
parameters from Positioned
widget to align your widget to the top right corner.
Example:
Positioned(
top:0.0,
right: 0.0,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: new IconButton(
icon: Icon(Icons.cancel,color: Colors.red,),
onPressed: () {}),
),
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With