I am able to set the background color of AppBar
to Colors.amber
. This automatically sets the text color to Black. I am aware of the accessibility issues that may arise but anyways I want the text color to be White.
I am still able to set the text color from the AppBar
but I would like to set it universally.
Here's the theme I'm using for my app.
title: 'Flutter Demo', theme: new ThemeData( primarySwatch: Colors.amber, textTheme: Theme.of(context).textTheme.apply( bodyColor: Colors.white, displayColor: Colors.white, ), ),
Go to the app > res > values > themes > themes.
Steps. Step 1: Inside the AppBar , add the iconTheme parameter and assign the IconThemeData widget. Step 2: Inside the IconThemeData, add the color parameter and assign the color of your choice.
Step 1: Locate the file where you have placed the AppBar widget. Step 2: Inside the AppBar widget, add the backgroundColor parameter and set the color of your choice.
I think the most straightforward way of doing this is to adjust the title color for the theme that you are working with:
theme: new ThemeData( primarySwatch: Colors.grey, primaryTextTheme: TextTheme( headline6: TextStyle( color: Colors.white ) ) )
I used a slightly different technique, I didn't use a theme, I just customized its appearance, so that when I created it looked like this:
appBar: new AppBar( iconTheme: IconThemeData( color: Colors.white ), title: const Text('Saved Suggestions', style: TextStyle( color: Colors.white )), backgroundColor: Colors.pink, ),
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With