Search code examples
flutterdockappbar

Is there a way to place the appbar at the bottom in flutter?


Is there a way to dock the appbar at the bottom in flutter?

Thanks.


Solution

  • AppBar is just a widget like any other. You can place it wherever you want.

    Even in the bottomNavigationBar field of Scaffold.

    final appBar = new AppBar(title: new Text("data"));
    return new Scaffold(
      body: new Center(
        child: new FlatButton(
          child: new Text("data"),
        ),
      ),
      bottomNavigationBar: new SizedBox(
        height: appBar.preferredSize.height,
        child: appBar,
      ),
    );
    

    Although you may as well use BottomAppBar in this situation.