How to display body under the AppBar of scaffold widget and not below?

后端 未结 7 1718
谎友^
谎友^ 2021-02-03 20:16

I\'m using a transparent AppBar and I would like to display body behind the transparent AppBar and not bellow. How to do that ?

7条回答
  •  旧时难觅i
    2021-02-03 20:25

    You can do this using this code

    return new Scaffold(
      body: new Stack(
        children: [
          new Container(
            color: Colors.blue.shade200,
          ),
          new AppBar(
            title: new Text("App bar"),
            backgroundColor: Colors.transparent,
            elevation: 0.0,
          ),
          new Positioned(
            top: 80.0,
            left: 0.0,
            bottom: 0.0,
            right: 0.0,
            //here the body
            child: new Column(
              children: [
                new Expanded(
                  child: Container(
                    color: Colors.grey,
                  ),
                )
              ],
            ),
          ),
        ],
      ),
    );
    

提交回复
热议问题