Flutter use Positioned widget to position a child relative to the top, right, bottom, or left edge of a Stack container. Here is an example of positioned widget:
Stack(
children: [
Positioned(
left: 10,
top: 10,
child: Text("I am positioned"),
),
],
)
n this example, the Text
widget with the message “I am positioned” will be positioned 10 pixels from the top and 10 pixels from the left edge of the Stack
container.
You can also use the right
and bottom
properties to position a child relative to the right and bottom edges of the container.
Stack(
children: [
Positioned(
right: 10,
bottom: 10,
child: Text("I am positioned"),
),
],
)
Learn more Flutter widget: