如何在 Flutter 应用程序中同时显示抽屉按钮和后退按钮?

Kya*_*Tun 9 appbar back navigation-drawer flutter

为了在深度导航中更快地导航到根页面,需要在AppBar 中显示 Back 和 Drawer 图标按钮。

在此处输入图片说明

如何在 Flutter 应用程序中做到这一点?

Put*_*yah 3

用 Row 包裹你的工具栏小部件

....
Row toolbar = new Row(
  children: <Widget>[
    new Icon(Icons.arrow_back),
    new Icon(Icons.menu),
    new Expanded(child: new Text(widget.title)),
    new Icon(Icons.arrow_forward)
  ]
);

return new Scaffold(
  appBar: new AppBar(
    title: toolbar,
  ),
....
Run Code Online (Sandbox Code Playgroud)

这是结果 在此输入图像描述

  • 谢谢,但是如何恢复默认的AppBar?事实上,后退按钮和菜单按钮在默认的 AppBar 设置中是自动的。现在看来,所有定制都需要添加功能和可能丢失的功能,例如引脚、浮动、标题行为。 (4认同)