1. What does the Stack widget do in Flutter?
Stack widget overlays multiple children on top of each other in paint order (first child is on the bottom, last child on top), allowing you to position widgets over each other. It's useful for creating overlays, badges, custom compositions, or layered effects where widgets need to overlap. Children can be positioned using Positioned widget which specifies exact positions relative to Stack edges using top, bottom, left, and right properties. Children without Positioned are sized by Stack's constraints and placed according to alignment property (default center). Non-positioned children are always sized to fit Stack's constraints. Stack sizes itself to contain all non-positioned children by default. Use alignment property to control how non-positioned children are placed within the Stack. Common use cases include placing badges on icons, overlaying loading indicators, creating custom layouts with overlapping elements, or building complex compositions like cards with images and text overlays.