I want to absolutely position a text on a container.
return Container(
height: 150,
width: 150,
decoration: BoxDecoration(
color: Color(0xE5E5EAee), borderRadius: BorderRadius.circular(20)),
child: Text('Camping'),
);
This is the present image
This is what need to be acheived
Did tried to position it with the ‘align positioned’ dependency. But got stuck with the same result.
3
Answers
Wrap the Text widget with Align widget and give alignment as the below code
Then give padding as per your need
You can try this, use a
Stack
and positioned theText
with the widgetPositioned
as you need it,Positioned
has 4 properties for position top, rigth, bottom and left for you to positioned the widget wherever you want.using your own example considering there is only one child in the container u can do the following but if u do have additional childrens the best way would be to use a Stack widget and use Align/Positioned widget to position the child widgets as per ur needs