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

Flutter 如何在Flatter中的我的应用程序栏上添加抽屉和搜索图标,flutter,Flutter,我是一个新来探索它的人。我已经有一个应用程序栏,但我似乎不知道如何正确显示抽屉图标和搜索图标。我希望它看起来像gmail应用程序栏,如下图所示。我正在开发一个公司帮助台移动应用程序。谢谢 按照中的说明进行操作 newappbar( 标题:新文本(“我的奇装异服”), 行动:[ 新建图标按钮(图标:新建图标(图标。播放列表_播放),工具提示:“播放它”,按下时:_airDress,),], 领先:[ 新图标按钮(图标:新图标(图标。播放列表\u播放),工具提示:“播放它”,按下时:\u airDr

我是一个新来探索它的人。我已经有一个应用程序栏,但我似乎不知道如何正确显示抽屉图标和搜索图标。我希望它看起来像gmail应用程序栏,如下图所示。我正在开发一个公司帮助台移动应用程序。谢谢

按照中的说明进行操作

newappbar(
标题:新文本(“我的奇装异服”),
行动:[
新建图标按钮(图标:新建图标(图标。播放列表_播放),工具提示:“播放它”,按下时:_airDress,),],
领先:[
新图标按钮(图标:新图标(图标。播放列表\u播放),工具提示:“播放它”,按下时:\u airDress,),
], )

其中,leading下的小部件是抽屉,actions下的小部件是search图标按钮。

您可以尝试以下代码

      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: () {
            },
          )
        ],
      ),
appBar:appBar(
主角:建筑商(
生成器:(BuildContext上下文){
返回图标按钮(
图标:图标(图标菜单),
已按下:(){
},
);
}),
标题:文本(“颤振应用程序”),
行动:[
图标按钮(
图标:图标(Icons.search),
已按下:(){
},
),
图标按钮(
图标:图标(Icons.search),
已按下:(){
},
)
],
),

这是最简单的

appBar: AppBar(
    actions: <Widget>[
      IconButton(
        icon: Icon(Icons.search),
        onPressed: () {},
      ),
      IconButton(
        icon: Icon(Icons.person),
        onPressed: () {
        },
      )
    ],
    centerTitle: true,
    backgroundColor: Colors.red,
    title: Text(
      "Your title",
      style: TextStyle(
        color: Colors.white,
        fontSize: 30,
        fontWeight: FontWeight.bold,
        fontStyle: FontStyle.italic,
      ),
    ),
  ),
appBar:appBar(
行动:[
图标按钮(
图标:图标(Icons.search),
按下:(){},
),
图标按钮(
图标:图标(Icons.person),
已按下:(){
},
)
],
标题:对,
背景颜色:Colors.red,
标题:正文(
“你的头衔”,
样式:TextStyle(
颜色:颜色,白色,
尺寸:30,
fontWeight:fontWeight.bold,
fontStyle:fontStyle.italic,
),
),
),

只需查看颤振文档和升级版本即可轻松解决此问题=>@mate00这是一个带有操作(包含搜索图标、人物图标和检测)的AppBar,标题和背景颜色居中,
appBar: AppBar(
    actions: <Widget>[
      IconButton(
        icon: Icon(Icons.search),
        onPressed: () {},
      ),
      IconButton(
        icon: Icon(Icons.person),
        onPressed: () {
        },
      )
    ],
    centerTitle: true,
    backgroundColor: Colors.red,
    title: Text(
      "Your title",
      style: TextStyle(
        color: Colors.white,
        fontSize: 30,
        fontWeight: FontWeight.bold,
        fontStyle: FontStyle.italic,
      ),
    ),
  ),