Kinda Code
Home/Flutter/Flutter: How to center the appBar title on Android

Flutter: How to center the appBar title on Android

Last updated: February 04, 2023

In Flutter, the appBar title on Android is on the left side by default. You can center it by setting the centerTItle property to true, like this:

centerTitle: true,

Example:

// main.dart
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'KindaCode.com',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const HomePage(),
    );
  }
}

class HomePage extends StatelessWidget {
  const HomePage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        centerTitle: true,
        title: const Text(
          'Kindacode.com',
        ),
      ),
      body: const Center(),
    );
  }
}

Output:

Hope this helps. Further reading:

You can also check out our Flutter category page or Dart category page for the latest tutorials and examples.