catch exception of getting medium thumbnail to show default image
This commit is contained in:
parent
607a8d6f70
commit
ce01bdb79e
@ -29,14 +29,19 @@ class ThumbnailProvider extends ImageProvider<ThumbnailProvider> {
|
|||||||
|
|
||||||
Future<ui.Codec> _loadAsync(ThumbnailProvider key, ImageDecoderCallback decode) async {
|
Future<ui.Codec> _loadAsync(ThumbnailProvider key, ImageDecoderCallback decode) async {
|
||||||
assert(key == this);
|
assert(key == this);
|
||||||
final data = await PhotoGallery.getThumbnail(
|
late ui.ImmutableBuffer buffer;
|
||||||
mediumId: mediumId,
|
try {
|
||||||
mediumType: mediumType,
|
final data = await PhotoGallery.getThumbnail(
|
||||||
height: height,
|
mediumId: mediumId,
|
||||||
width: width,
|
mediumType: mediumType,
|
||||||
highQuality: highQuality,
|
height: height,
|
||||||
);
|
width: width,
|
||||||
ui.ImmutableBuffer buffer = await ui.ImmutableBuffer.fromUint8List(Uint8List.fromList(data));
|
highQuality: highQuality,
|
||||||
|
);
|
||||||
|
buffer = await ui.ImmutableBuffer.fromUint8List(Uint8List.fromList(data));
|
||||||
|
} catch (e) {
|
||||||
|
buffer = await ui.ImmutableBuffer.fromAsset("packages/photo_gallery/images/grey.bmp");
|
||||||
|
}
|
||||||
return decode(buffer);
|
return decode(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user