AppBar Widget in Flutter

AppBar Widget in Flutter

AppBar class :

  • A Material Design app bar.

  • An app bar consists of a toolbar and potentially other widgets, such as a TabBar and a FlexibleSpaceBar. App bars typically expose one or more common actions with IconButtons which are optionally followed by a PopupMenuButton for less common operations (sometimes called the "overflow menu").

  •   AppBar(
        title: Text('Flutter AppBar '),
      )
    

Components and Structure of Flutter AppBar

The AppBar mainly comprises two parameterized properties:

  • The Title: title is a parameter in the AppBar Class that takes a text widget.

  • The Leading widget: leading defines the widget displayed before the title.

However, the AppBar can avail other widgets like icons and buttons to enrich its functionality and interactivity.

Let's take a simple example of an app bar with a leading menu icon and a title:

AppBar(
  leading: Icon(Icons.menu),
  title: Text('Flutter AppBar '),
)