Flutter - How To Change AppBar Text Color

In flutter, Appbar widget is the most useful widget. Appbar widget is used to show the name of the current screen with an icon and some important actions that you can handle on a page such as navigation, search, filter, logout, etc. So in this tutorial, I am going to share with you how to change the color of the appbar text in the easiest way.

Syntax

AppBar(
        centerTitle: true,
        title: Text("Errorgram",style:TextStyle(color:Colors.black),),//Change color here
      ),

Let's take an example like below

class Errorgram extends StatefulWidget {
  const Errorgram({Key? key, required this.title}) : super(key: key);
  final String title;
  @override
  State<Errorgram> createState() => _ErrorgramState();
}

class _ErrorgramState extends State<Errorgram> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        centerTitle: true,
        title: Text("Errorgram",style:TextStyle(color:Colors.black),),//Change color here
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            const Text(
              'Errorgram',
            ),

          ],
        ),
      ),

    );
  }
}

I hope you like this article and it will be help to you.

Tags: