如何在Flutter中在我的应用栏上添加抽屉和搜索图标

Pri*_*nte 8 flutter

我是初次接触并探索它。我已经有一个应用程序栏,但似乎无法弄清楚如何在其上正确显示抽屉图标和搜索图标。我希望它看起来像gmail应用程序栏,如下图所示。我正在开发公司的技术支持移动应用程序。谢谢。

gmail应用栏

Bos*_*rot 17

按照flutter文档中所述进行操作。

new AppBar( 
    title: new Text('My Fancy Dress'), 
    actions: <Widget>[ 
        new IconButton( icon: new Icon(Icons.playlist_play), tooltip: 'Air it', onPressed: _airDress, ),],
    leading: <Widget>[
        new IconButton( icon: new Icon(Icons.playlist_play), tooltip: 'Air it', onPressed: _airDress, ),
], )
Run Code Online (Sandbox Code Playgroud)

最下面的小部件是抽屉,而最下面的小部件是搜索图标按钮。


小智 8

你可以试试这个代码....

      appBar: AppBar(
        leading: Builder(
            builder: (BuildContext context){
              return IconButton(
                icon: Icon(Icons.menu),
                onPressed: () {

                },
              );
            }),
        title: Text("Flutter App"),
        actions: <Widget>[
          IconButton(
            icon: Icon(Icons.search),
            onPressed: () {
            },
          ),
          IconButton(
            icon: Icon(Icons.search),
            onPressed: () {
            },
          )
        ],
      ),
Run Code Online (Sandbox Code Playgroud)