Stack Positioned

The descriptions of each prop used in this example are as follows: Stack widget props:

  • children: This array defines the child widgets that will be layered on top of each other. Each child can be a Positioned widget to specify its exact position within the stack.

Positioned widget props:

  • top: The distance from the top of the stack to the top of the widget. If specified, it positions the widget from the top.
  • bottom: The distance from the bottom of the stack to the bottom of the widget. If specified, it positions the widget from the bottom.
  • left: The distance from the left side of the stack to the left side of the widget. If specified, it positions the widget from the left.
  • right: The distance from the right side of the stack to the right side of the widget. If specified, it positions the widget from the right.

Layout description:

  • The Stack contains multiple Positioned widgets, each specifying its position within the stack:
    • A blue container is positioned at the top-left corner.
    • A red container is positioned at the top-right corner.
    • A green container is positioned at the bottom-left corner.
    • A yellow container is positioned at the bottom-right corner.

This configuration allows precise control over the placement of widgets within a two-dimensional space, enabling complex layouts.