Turkey
Turkey

Reputation: 425

How to set the height of the title in the appbar in Flutter

In my Flutter app, I have an AppBar and the title of it is a clickable InkWell.

My issue is that this clickable area is not the full height of the app bar - it is just a thin slither the height of the title text - and I want, for more pleasing UI, for the clickable area to be the full height of the app bar.
(Note that it is not the full width, and I achieve that by wrapping the InkWell in Padding)

How can I make the title text in the app bar have more height?

(Or otherwise achieve making my ink well be the full height of the AppBar)

Upvotes: 1

Views: 892

Answers (1)

Turkey
Turkey

Reputation: 425

I found the answer.

Instead of using the title property in the AppBar, use the flexibleSpace property.

And set the height of the Container you wrap your InkWell in, to a value of preferredSize.height (meaning, get the height of the AppBar itself).

      AppBar(
          flexibleSpace: Container( 
            padding: EdgeInsets.fromLTRB(100, 0, 100, 0),
            height: preferredSize.height,
            child: InkWell(

Upvotes: 2

Related Questions