Open rooscarljohan opened 3 years ago
I see why you'd want this. However, the workaround in CachedNetworkImage is really a workaround and I think it needs some more work to make a decent implementation. The problem is that in this work around the ImageProvider is used to create an Image Widget which you then throw away to create a new image widget. It is not that bad that it can't be used as a workaround, but I think we need to clone the image widget to do the loading and creation of the widget ourselves.
Thanks. And agree - the workaround isn't really great.
What about providing dual constructors 1) imageProviderBuilder (context, imageProvider) 2) imageBuilder (context, image-widget)
and assess XOR !=null between the two?
then you can decide what to provide, an image-widget OR an imageProvider
Yes that would be nice, but still we need to rewrite the core flutter image widget to not create an image widget twice. I don't like making such a builder using the workaround hack.
Great package!
Sometimes it is also valuable to obtain the imageprovider in the imageBuilder constructor.
Currently it looks like this: typedef OctoImageBuilder = Widget Function(BuildContext context, Widget child);
Hence I'd like it changed to typedef OctoImageBuilder = Widget Function(BuildContext context, Widget child, Imageprovider image);
Had a look at CachedNetworkImage, and did a workaround:
but would be more slick to have the imageprovider directly in the imageBuilder's constructor