Reputation: 9230
If I set a Flutter app's primarySwatch
in a MaterialApp
's themeData
, then the background of my app's icon shows with the primary swatch color, above my Flutter app's screen, whenever I hit the Android app switcher button.
I want to be able to change the icon background color to white, without changing the primary swatch of the app. Is there any way to do this, other than by creating an icon that has a white background?
Here is an example of what I'm talking about... here the icon image is an asterisk in a white circle with a transparent background around the circle. The Android app switcher puts the icon inside a larger circle which uses the primary swatch color, deepPurple
, as its background:
The reason the icon background is purple is because I use this code in my Flutter app:
final widget = MaterialApp(
theme: ThemeData(primarySwatch: Colors.deepPurple),
/*...*/ );
What I want to do is change the switcher icon background color to white without changing the primary theme color of the app.
Upvotes: 1
Views: 1979
Reputation: 3077
By default, the OS interface will use themeData.primaryColor
. You can override this by passing in color
to MaterialApp
.
final widget = MaterialApp(
color: Colors.white,
theme: ThemeData(primarySwatch: Colors.deepPurple),
/*...*/ );
NOTE: This will not only affect the icon background in Android's modern app switcher but will also affect the app bar used in the classic app switcher.
Upvotes: 3