flutter 禁用全屏对话框上的“取消”按钮

dba5bblo  于 2023-05-19  发布在  Flutter
关注(0)|答案(3)|浏览(163)

我正在推一个fullscreenDialog设置为true的屏幕。左上方添加了一个取消图标。我想用我自己的图标和功能(删除)替换此取消图标。我如何覆盖该图标?

uttx8gqw

uttx8gqw1#

您需要使用AppBarleading属性来覆盖X按钮。参见以下示例:

appBar: AppBar(
  title: Text("2nd page"),
  leading: IconButton(
    icon: Icon(Icons.delete), 
    onPressed: (){
    // handle delete here
   }),
)
bq8i3lrv

bq8i3lrv2#

appBar: AppBar(
  title: Text("2nd page"),
  leading: Container()
)

如果你想隐藏按钮。

xmjla07d

xmjla07d3#

appBar: AppBar(
      title: Text(AppLocalizations.of(context)!.profile),
      leading: null,
      leadingWidth: 0,
     )

相关问题