Flutter 如何从折叠抽屉中取出汉堡按钮?
我已经学习了如何在flatter中设置抽屉(Flutter 如何从折叠抽屉中取出汉堡按钮?,flutter,Flutter,我已经学习了如何在flatter中设置抽屉(returnnewscaffold(抽屉:newdrawer(…)或returnnewscaffold(endDrawer:newdrawer(…)) 如何移除顶部的汉堡包按钮(这样您只能通过从侧面滑动(或通过应用程序中的自定义按钮-我知道如何操作))来获取抽屉?只需将AppBar中的前导属性设置为空容器即可 appBar: new AppBar( leading: new Container(), .... 为了移除en
returnnewscaffold(抽屉:newdrawer(…)
或returnnewscaffold(endDrawer:newdrawer(…)
)
如何移除顶部的汉堡包按钮(这样您只能通过从侧面滑动(或通过应用程序中的自定义按钮-我知道如何操作))来获取抽屉?只需将
AppBar
中的前导属性设置为空容器即可
appBar: new AppBar(
leading: new Container(),
....
为了移除endDrawer
(对于RtL)。它被放置在操作
属性所在的位置,因此也只需添加一个空的容器
,作为操作
属性的单个子级
appBar: new AppBar(
actions: <Widget>[
new Container(),
],
.....
appBar:新的appBar(
行动:[
新容器(),
],
.....
使用AppBar上的属性将正常抽屉设置为false
对于末端抽屉,您应执行以下操作:
actions: [Container()]
在AppBar中,需要执行以下操作以隐藏默认渲染汉堡图标
AppBar(
automaticallyImplyLeading: false, // this will hide Drawer hamburger icon
actions: <Widget>[Container()], // this will hide endDrawer hamburger icon
... // other props
),
SilverAppBar(
automaticallyImplyLeading: false, // this will hide Drawer hamburger icon
actions: <Widget>[Container()], // this will hide endDrawer hamburger icon
... // other props
}
AppBar(
automaticallyImplyLeading:false,//这将隐藏抽屉汉堡图标
操作:[Container()],//这将隐藏收尾抽屉汉堡图标
…//其他道具
),
并在SilverAppBar中执行以下操作以隐藏默认渲染汉堡图标
AppBar(
automaticallyImplyLeading: false, // this will hide Drawer hamburger icon
actions: <Widget>[Container()], // this will hide endDrawer hamburger icon
... // other props
),
SilverAppBar(
automaticallyImplyLeading: false, // this will hide Drawer hamburger icon
actions: <Widget>[Container()], // this will hide endDrawer hamburger icon
... // other props
}
SilverAppBar(
automaticallyImplyLeading:false,//这将隐藏抽屉汉堡图标
操作:[Container()],//这将隐藏收尾抽屉汉堡图标
…//其他道具
}
如果您将AppBar()
小部件堆叠在SliverAppBar()
小部件的顶部,我希望这将有助于……您只需要在SliverAppBar()
小部件中执行自动加载:false
这将从AppBar
中删除汉堡图标
顺便问一下,为什么会这样?有人能告诉我吗
我不明白….删除左侧按钮的操作。我应该如何删除右侧按钮?覆盖action属性,检查答案。将new Container()设置为前导后,它仍会占用一些空间(空框)。因此,“标题”前会有一个空白。若要删除它,请参阅下面的答案。谢谢!在滑动应用栏上将自动Impling
设置为false对我很有效。