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.
0 Comments