Open TitikshaDaga opened 7 years ago
Can you provide some example code (even if not your image)?
Hey @eseidelGoogle sorry for the late reply. This is the code and image that I have used
new ListTile(
title: new Text("Saved Searches"),
leading: new ImageIcon(new AssetImage('assets/SaveMenu.png')),
onTap: () {
Navigator.popAndPushNamed(context, '/SavedSearches');
},
)
Try wrapping the ImageIcon
in an IconTheme
whose color
is null.
We should offer a way to opt-out of the colourising, though.
Unfortunately, the same issue exists with ImageIcon's width, height, and opacity parameters. I don't think we'd want to gradually introduce overrides for them, since ImageIcon really doesn't do very much.
It might be simpler to just use Image directly, if the ImageIcon class is getting in the way.
Semantics(
label: mySemanticLabel,
child: Image(
image: myImage,
width: myIconSize,
height: myIconSize,
fit: BoxFit.scaleDown,
alignment: Alignment.center,
excludeFromSemantics: true,
),
);
The whole point of using ImageIcon is to honour the height and width, so I'm not too worried about that. The opacity... maybe. I'd have to see specific examples where that's an issue.
I have the same issue, and I need to use the image in NavigationBar. https://stackoverflow.com/questions/61915579/how-to-display-an-image-in-the-bottomnavigationbar-in-flutter/61938732#61938732
This issue is reproducible in 1.20.0-7.1.pre
.
I'm using these red rounded icons and it got decolorized,
child: IconButton( icon: ImageIcon(AssetImage("assets/icons/library.png")), onPressed: (){
},
),
library.png look like black
I'm interested in resolving this issue, does anyone have any suggestions for improvements to the API?
IMO ImageIcon
is a wrapper for semantics and other properties, especially when you're using it in BottomNavigationBar
. The item should change color according to your configuration in the bar. So it can be use to sync properties with parent's theme, otherwise you don't need to use the ImageIcon
.
I can reproduce this issue with Master (3.7.0-4.0.pre.48)
. Updating labels to reflect the same
I wanted to use a multi color image as my icon the way it was. But when i made it an image icon it got decolorized. How do I restore the original colors?