Flutter › Layout Widgets (Row, Column, Stack, Container)

How does the Stack widget let you genuinely layer several separate child widgets directly on top of one another, and how does the Positioned widget let you precisely control exactly where each individual layered child actually appears within that Stack?

Intermediate

Answer

Stack lets you place several separate child widgets so they genuinely overlap directly on top of one another rather than being arranged neatly side by side the way Row or Column would otherwise arrange them, with each subsequent child painted genuinely on top of the previous ones, and wrapping a specific given child with the Positioned widget lets you precisely and explicitly control exactly where that particular specific child should actually appear relative to the edges of that surrounding Stack, such as pinning a small badge icon to a specific product photo's own top right corner.
Stack(
  children: [
    Image.network(productImageUrl),
    Positioned(top: 8, right: 8, child: Badge(label: Text('New'))),
  ],
)
Real-world example A product card displays a small new badge precisely pinned to its own product image's top right corner using Stack together with Positioned, achieving a genuinely common, visually appealing layering effect that would simply not actually be possible using Row or Column alone.

Common follow-ups: What genuinely happens to a child within a Stack that is not actually wrapped with Positioned at all?;How do you actually properly center a specific child widget precisely directly within a surrounding Stack?