by @kodeazy

flutter how to align title center of the appBar?

Home » flutter » flutter how to align title center of the appBar?

In this blog we will discuss on how to align title center of the appBar.
To align title at the center of the AppBar Widget we have a property called centerTitle.
By making centerTitle property true we can align the text at the center in appBar.
Below is an example syntax

Scaffold(
        appBar: AppBar(centerTitle: true)
      )

Below is an example program of aligining the title at the center of the AppBar

import 'package:flutter/material.dart';
void main() {
  runApp(
    MaterialApp(
      home: Scaffold(
        appBar: AppBar(centerTitle: true,
          title: Text("Center Titler example"),)
      ),
    )
  );
}

Output: Normal Function example Image