title property

Widget? title
final

The primary widget displayed in the app bar.

Becomes the middle component of the NavigationToolbar built by this widget.

Typically a Text widget that contains a description of the current contents of the app.

The title's width is constrained to fit within the remaining space between the toolbar's leading and actions widgets. Its height is not constrained. The title is vertically centered and clipped to fit within the toolbar, whose height is toolbarHeight. Typically this isn't noticeable because a simple Text title will fit within the toolbar by default. On the other hand, it is noticeable when a widget with an intrinsic height that is greater than toolbarHeight is used as the title. For example, when the height of an Image used as the title exceeds toolbarHeight, it will be centered and clipped (top and bottom), which may be undesirable. In cases like this the height of the title widget can be constrained. For example:

MaterialApp(
  home: Scaffold(
    appBar: AppBar(
      title: SizedBox(
        height: _myToolbarHeight,
        child: Image.asset(_logoAsset),
      ),
      toolbarHeight: _myToolbarHeight,
    ),
  ),
)

Implementation

final Widget? title;