dakamojo
dakamojo

Reputation: 1955

Disable Cancel button on fullscreen dialog

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

Upvotes: 3

Views: 1624

Answers (3)

Jagie
Jagie

Reputation: 2220

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

Upvotes: -1

wamae
wamae

Reputation: 840

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

If you want the button hidden.

Upvotes: 1

CopsOnRoad
CopsOnRoad

Reputation: 267514

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
   }),
)

Upvotes: 2

Related Questions