Adding RawImage component which takes in raw bytes

in the form of a Uint8List and decodes and renders
the bytes as an image.
This commit is contained in:
Ali Ghassemi
2015-11-03 08:52:21 -08:00
parent a0c8a4c61e
commit 38e3e9fd48

View File

@@ -1095,6 +1095,39 @@ class DefaultAssetBundle extends InheritedWidget {
bool updateShouldNotify(DefaultAssetBundle old) => bundle != old.bundle;
}
class RawImage extends StatelessComponent {
RawImage(
{Key key,
this.bytes,
this.width,
this.height,
this.colorFilter,
this.fit,
this.repeat: ImageRepeat.noRepeat,
this.centerSlice})
: super(key: key);
final Uint8List bytes;
final double width;
final double height;
final ColorFilter colorFilter;
final ImageFit fit;
final ImageRepeat repeat;
final Rect centerSlice;
Widget build(BuildContext context) {
ImageResource image = new ImageResource(decodeImageFromList(bytes));
return new ImageListener(
image: image,
width: width,
height: height,
colorFilter: colorFilter,
fit: fit,
repeat: repeat,
centerSlice: centerSlice);
}
}
class AssetImage extends StatelessComponent {
AssetImage({
Key key,