How to Center the title in AppBar widget in Flutter

How to Center the title in AppBar widget in Flutter

By default the title in the AppBar widget in Flutter applications is left aligned and we may want to align it to the center.

Aligning title of AppBar widget to Center in Flutter is very much straight forward. All we need to do is to add an option centerTitle and set its value to true in the widget.

centerTitle: true

full code:

Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('How to Flutter') ,
        centerTitle: true,
      ),
    ) ;
  }

The output for the above code will be:

Read more about AppBar widget here: Deep Dive into AppBar

Leave A Comment

Your email address will not be published. Required fields are marked *