Navaron Bracke
Navaron Bracke

Reputation: 21

CupertinoThemeData doesn't use specified primary color?

I have a class where I specify ThemeData for my app. I use this class to set the appropriate theme in either the MaterialApp or CupertinoApp.

return CupertinoApp(
//...
theme: AppicationTheme.iosTheme()
//...
);

My IOS theme is provided as follows

static CupertinoThemeData iosTheme(){
 return CupertinoThemeData(primaryColor: myPrimaryColor);
}

However when trying to set the color on an Icon, the primary color is still default blue as if never set to my color.

Upvotes: 1

Views: 1281

Answers (1)

AlabamaOr
AlabamaOr

Reputation: 31

You are probably using Theme.of(context).primaryColor, switch Theme to CupertinoTheme.

example:

Icon(Icons.access_alarm,<br>
     color: CupertinoTheme.of(context).primaryColor,
),

Upvotes: 3

Related Questions