0

In my application there is some action,that I needed to perform in AppBar back button. My issue is, I want to use default back button with my click action.

So its possible to do this stuff.

2 Answers 2

3

try

appBar: AppBar(
        leading: BackButton(
          onPressed: (){
            print("back Pressed");
          },
        ),
      ),
Sign up to request clarification or add additional context in comments.

5 Comments

I want my own navigation action.not back action perform
ah now i got your point, so you need to override the onClick method of the back button in the appbar?
yes, I need my own action. Not back navigation
I edited the answer to match your question
Ok,I will check this and revert you.
0
appBar: AppBar(
              automaticallyImplyLeading: false,
              leading: Builder(
                builder: (BuildContext context) {
                  return IconButton(
                    icon: const Icon(Icons.arrow_back),
                    onPressed: () {
                      // Do your thing..
                    },
                  );
                },
              ),
              title: Text("Your Text"),
              centerTitle: true,

I hope that answers..

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.