Framelayout alternative in flutter

I want to add a Flutter Container in top of another Container and top container will be transparent. Basically I do that in native Android using FrameLayout. How to implement this in Flutter?

Stack is most likely what you want.

Stack allows to put widgets on the top of others however you like. And, combined with Positioned, have custom positions.

Let's draw a real frame in flutter :



Stack(
alignment: Alignment.center,
children: <Widget>[
Container(
width: 200.0,
height: 300.0,
decoration: BoxDecoration(
color: Colors.black12,
border: Border.all(
color: Colors.black,
width: 3.0,
),
),
),
Container(
width: 100.0,
height: 100.0,
color: Colors.blue,
),
Positioned(
bottom: 10.0,
right: 10.0,
child: Card(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text("Title"),
),
),
)
],
),

Comments

Popular posts from this blog

Meaning of `{}` for return expression

Get current scroll position of ScrollView in React Native

flutter websocket connection issue