Created
April 9, 2019 22:42
-
-
Save iskakaushik/5868869a6312e52df53f89ba9de083c4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SizeAwareImageCacheKey { | |
const SizeAwareImageCacheKey(this._providerCacheKey, this._imageSize); | |
final dynamic _providerCacheKey; | |
final Size _imageSize; | |
} | |
class SizeAwareImageProvicer | |
extends ImageProvider<SizeAwareImageCacheKey> { | |
const SizeAwareImageProvicer(this._imageProvider, this.imageSize); | |
final ImageProvider _imageProvider; | |
final Size imageSize; | |
@override | |
ImageStreamCompleter load(SizeAwareImageCacheKey key) { | |
return _imageProvider.load(key._providerCacheKey, size: key._imageSize); | |
} | |
@override | |
Future<SizeAwareImageCacheKey> obtainKey( | |
ImageConfiguration configuration) async { | |
final dynamic providerCacheKey = _imageProvider.obtainKey(configuration); | |
return SizeAwareImageCacheKey(providerCacheKey, imageSize); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment