sina .s
sina .s

Reputation: 99

two widgets on top of each other

I want to put another widget on the top corner of a container, and I want to put it slightly out of the container as in the picture below.

enter image description here

Upvotes: 0

Views: 873

Answers (1)

eamirho3ein
eamirho3ein

Reputation: 17880

Use Stack widget and set its clipBehavior to none:

Stack(
    clipBehavior: Clip.none, // <--- important part
    children: [
      Container(
        width: 200,
        height: 100,
        color: Colors.blue,
      ),
      Positioned(
        right: -10,
        top: -10,
        child: Container(
          width: 50,
          height: 20,
          color: Colors.green,
        ),
      ),
    ],
  ),

enter image description here

Upvotes: 2

Related Questions