Removed extraenous nesting else statements and added comments

This commit is contained in:
Marty Fuhry 2023-05-08 10:12:15 -04:00
parent fba940335c
commit 292e44ded7
No known key found for this signature in database
GPG key ID: E2AB6392D894D900

View file

@ -373,24 +373,31 @@ class GalleryViewerPage extends HookConsumerWidget {
);
}
/// The image provider to use for the given asset
ImageProvider imageProvider(Asset asset) {
// Local assets
if (asset.isLocal) {
return localImageProvider(asset);
} else {
if (isLoadOriginal.value) {
return originalImageProvider(asset);
} else if (isLoadPreview.value) {
return remoteThumbnailImageProvider(
asset,
api.ThumbnailFormat.JPEG,
);
} else {
return remoteThumbnailImageProvider(
asset,
api.ThumbnailFormat.WEBP,
);
}
}
// Original assets
if (isLoadOriginal.value) {
return originalImageProvider(asset);
}
// Preview uses remote JPEG
if (isLoadPreview.value) {
return remoteThumbnailImageProvider(
asset,
api.ThumbnailFormat.JPEG,
);
}
// Otherwise, use the thumbnail preview
return remoteThumbnailImageProvider(
asset,
api.ThumbnailFormat.WEBP,
);
}
return Scaffold(