How to add button to bottom navigation bar which hang out above - Flutter

后端 未结 4 1902

I have bottom navigation bar with center item that looks like on this picture:

How to implement such a thing in Flutter?

I found that every icon that I

4条回答
  •  一向
    一向 (楼主)
    2021-02-10 09:38

    You can also do this using FloatingActionButtonLocation and Expanded widget like this:

    Widget build(BuildContext context) {
        return new Scaffold(
          appBar: new AppBar(
            title: new Text(widget.title),
          ),
          body: _buildTodoList(),
          floatingActionButton: new FloatingActionButton(
            onPressed: _pushAddTodoScreen,
            tooltip: 'Increment',
            child: new Icon(Icons.add),
            elevation: 4.0,
          ),
          bottomNavigationBar: BottomAppBar(
            child: new Row(
              mainAxisAlignment: MainAxisAlignment.center,
              children: [
                Expanded(child: IconButton(icon: Icon(Icons.home)),),
                Expanded(child: IconButton(icon: Icon(Icons.show_chart)),),
                Expanded(child: new Text('')),
                Expanded(child: IconButton(icon: Icon(Icons.tab)),),
                Expanded(child: IconButton(icon: Icon(Icons.settings)),),
              ],
            ),
          ),
          floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
        );
      }
    

    Preview:

提交回复
热议问题