Skip to content

Commit

Permalink
fix: Raster cache should support ErrorBuilder (#5475)
Browse files Browse the repository at this point in the history
* Raster cache should support `ErrorBuilder`

* Prevent duplicated code
  • Loading branch information
g123k committed Jul 5, 2024
1 parent 173c34d commit 68e8140
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions packages/smooth_app/lib/cards/category_cards/raster_cache.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class RasterCache extends AbstractCache {
if (fullFilenames.isEmpty) {
return getDefaultUnknown();
}

return Image.network(
iconUrl!,
width: width,
Expand All @@ -30,15 +31,25 @@ class RasterCache extends AbstractCache {
if (loadingProgress == null) {
return child;
}
return RasterAsyncAsset(
AssetCacheHelper(
fullFilenames,
iconUrl!,
width: width,
height: height,
),
);
return _localAssetWidget(fullFilenames);
},
errorBuilder: (
final BuildContext context,
final Object error,
final StackTrace? stackTrace,
) =>
_localAssetWidget(fullFilenames),
);
}

RasterAsyncAsset _localAssetWidget(List<String> fullFilenames) {
return RasterAsyncAsset(
AssetCacheHelper(
fullFilenames,
iconUrl!,
width: width,
height: height,
),
);
}
}

0 comments on commit 68e8140

Please sign in to comment.