Flutter ImageIcon showing image white or black

Petahwil

So I have been trying to use a picture I have stored in assets and use it as a logo. This way I can animate the logo rather then just having it as a static picture. But the logo keeps showing up just white or when I tried to wrap it and set the colors to null then it shows it all black. So wondering how I get it to show my original image.

new IconTheme(
data: new IconThemeData(
  color: null,
),//IconThemeData
  child: new ImageIcon( new AssetImage("images/logo.png"), color: null, size: _logoAnimation.value * 200),//Logo

),//IconTheme
Hemanth Raj

This happens because, the IconThemeData returned by IconTheme.of method is merged with IconThemeData.fallback() which has a default color as black.

You can look here to know what actually the IconTheme.of method returns and the IconThemeData.fallback() just returns this.

You can raise an issue regarding the same here.

As a workaround, you can just do what ImageIcon does with color as null.

Example:

new Image(
  image: new AssetImage("images/logo.png"),
  width: _logoAnimation.value * 200,
  height: _logoAnimation.value * 200,
  color: null,
  fit: BoxFit.scaleDown,
  alignment: Alignment.center,
)

Hope that helps!

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related