iDecode
iDecode

Reputation: 29016

AppBar's foregroundColor property not working

Scaffold(
  appBar: AppBar(
    foregroundColor: Colors.orange, // Has no impact
    leading: Icon(Icons.call),
    title: Text('AppBar'),
  ),
)

From docs:

foregroundColor: The default color for Text and Icons within the app bar.

But none of my Text and icons in the app bar seems to have the orange color.

Upvotes: 3

Views: 2457

Answers (3)

iDecode
iDecode

Reputation: 29016

You need to set backwardsCompatibility to false to let foregroundColor property to work. This is a new property which is true by default for now and once there's no longer a breaking change, it will be made false by default.

AppBar(
  foregroundColor: Colors.orange,
  backwardsCompatibility: false,
  title: Text('AppBar'),
)

Upvotes: 9

dm_tr
dm_tr

Reputation: 4783

AppBar has no property foregroundColor (maybe removed). Use textTheme and iconTheme instead to change it's Text and Icons color

Upvotes: -1

benzo
benzo

Reputation: 431

you can do it this way

 iconTheme: IconThemeData(
    color: Colors.orange
  ),
  title: const Text('Saved Suggestions', style: TextStyle(
    color: Colors.orange
  )),
  backgroundColor: Colors.white,

Upvotes: 0

Related Questions