How to Center Align Flutter App Bar Title?

Flutter – Center Align Application Bar Title

To center align text of App Bar title, use Scaffold and in appBar, set the centerTitle property to true.

Following is a quick code snippet to align title at the center of application bar.

Scaffold(
  appBar: AppBar(
    centerTitle: true,
    title: Text(
      'Flutter Tutorial',
  ),
),

centerTitle: true sets the text in title at center.

Example 1: Center Align Title in App Bar

Create a Flutter application and replace the code of main.dart with the following code.

main.dart

import 'package:flutter/material.dart';

void main() {
  runApp(MaterialApp(
    title: 'Flutter Tutorial',
    home: MyApp(),
    debugShowCheckedModeBanner: false,
  ));
}

class MyApp extends StatefulWidget {
  @override
  _State createState() => _State();
}

class _State extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        centerTitle: true,
        title: Text(
          'Flutter Tutorial',
        ),
      ),
      body: Container(),
    );
  }
}

Run this application in an Android or Apple device.

Screenshot

Flutter - Center Align Title in Application Bar

Summary

In this Flutter Tutorial, we learned how to align app bar title at center.

Desclaimer: We are not affiliated, associated, authorized, endorsed by, or in any way officially connected with the Google, Apple or Flutter, or any of its subsidiaries or its affiliates. The names Google, Apple and Flutter as well as related names, marks, emblems and images are registered trademarks of their respective owners. This site googleflutter.com covers tutorials related to Flutter developed by Google.