Flutter Clickable Appbar Title

CodeWithFlutter
1 Min Read

Flutter making clickable appbar title is very very easy. To make the clickable appbar title in a flutter, wrap the Text widget as InkWell or GestureDetector.

In this tutorial, you will learn how to make a clickable appbar title in the flutter app.

Consider the appbar looks lke this,

 appBar: AppBar(
          centerTitle: true,
          title: Text("Clickable Appbar Title"),
        ),

To make the title clickable, wrap the text widget as InkWell or GestureDetector Widget.

 appBar: AppBar(
          centerTitle: true,
          title: InkWell(
            onTap: () {
              print("Title Text CLicked");
            },
            child: Text("Clickable Appbar Title"),
          ),
        ),

Then, write your code on the onTap () {} function.

Also read, How to center the title of an appbar.

Flutter clickable Title Text
Share this Article
Leave a comment