How Flutter adds a top-level view (similar to iOS adding to a window)

Viewed 68

enter image description here The widget is always displayed on the screen, just like in iOS, adding controls to the window. How to achieve it, thank you! Grateful!

4 Answers

Add this to your MaterialApp to remove it

MaterialApp(
  debugShowCheckedModeBanner: false,
)

You can use Stack Widget to overlay Widgets over one another. For example:

Stack(
  children: <Widget>[
    Container(
      width: 100,
      height: 100,
      color: Colors.red,
    ),
    Container(
      width: 90,
      height: 90,
      color: Colors.green,
    ),
    Container(
      width: 80,
      height: 80,
      color: Colors.blue,
    ),
  ],
)

The Banner widget realises this by creating a CustomPainter, take a look at the Implementation. But I think a Stack would be the better choice here if you are using Widgets.

Related