Use ImageResource instead of Future<sky.Image>

Using ImageResource solves two problems:

1) Listeners can be notified synchronously when the sky.Image is already
   available. This change removes flash of 0x0 layout when moving an
   already-cached image around in the render tree.

2) In the future, when we support animated images, we can notify listeners
   multiple times whenever a new image is available.
This commit is contained in:
Adam Barth
2015-08-10 20:16:37 -07:00
parent 15e1e264a9
commit 9f228349e9
7 changed files with 136 additions and 53 deletions

View File

@@ -15,7 +15,7 @@ class ImageMap {
}
Future<Image> _loadImage(String url) async {
Image image = await _bundle.loadImage(url);
Image image = await _bundle.loadImage(url).first;
_images[url] = image;
return image;
}