flutter
Center the title in appbar flutter
This code snippet shows how to center a title in appbar. We can use centerTitle property of appBar to do this.
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text("APP DEMO"),
centerTitle: true //This will center the text
),
body: Container()
);
}
}
If you have created a flutter application and added an appBar widget to your project. If the title of the appbar is not center-aligned, you can use the centerTitle property and assign a value true to it.
AppBar(
centerTitle: true,
...
),
If you want do not want to align the title text center you can make centerTitle property false.
AppBar(
centerTitle: false,
...
),
The code will align the title text to the left.
Was this helpful?
Similar Posts
- Change the color of icons in appbar flutter
- Center Row widget children vertically and horizontally Flutter
- Change click action of left AppBar icon in Flutter
- Remove Back Button from Flutter Appbar
- Hide title from BottomNavigationBar in Flutter
- Converting class objects to JSON string in Flutter
- Add box shadow to container in flutter