Disable Cancel button on fullscreen dialog

Viewed 1056

I'm pushing a screen with fullscreenDialog set to true. There is a cancel icon added to the top left. I want to replace this cancel icon with my own icon and functionality (delete). How can I override that icon?

Screenshot

2 Answers

You need to use leading property of AppBar to override that X button. See below example:

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

If you want the button hidden.

Related