How can I put a widget above another widget in Flutter?

Shensheng Kuang picture Shensheng Kuang · Aug 24, 2018 · Viewed 15.1k times · Source

I would like to overlay a Round view on top of a background View just like in this screenshot below.

Getting like this

Answer

Zulfiqar picture Zulfiqar · Aug 24, 2018
@override
Widget build(BuildContext context) {
// TODO: implement build
return new Container(
  width: 150.0,
  height: 150.0,
  child: new Stack(children: <Widget>[
    new Container(
      alignment: Alignment.center,
      color: Colors.redAccent,
      child: Text('Hello'),
    ),
    new Align(alignment: Alignment.bottomRight,
      child: FloatingActionButton(
        child: new Icon(Icons.add),
          onPressed: (){}),
    )
  ],
  ),
);
}

above UI will look like this