Removes redundant factory fromAssetsOnly constructor from RenderList

This commit is contained in:
Marty Fuhry
2024-02-07 13:31:21 -05:00
committed by Zack Pollard
parent ed1294a0ea
commit 0ab6a26871
2 changed files with 5 additions and 20 deletions
@@ -56,24 +56,6 @@ class RenderList {
RenderList(this.elements, this.query, this.allAssets)
: totalAssets = allAssets?.length ?? query!.countSync();
/// Creates a new render list from assets
factory RenderList.fromAssetsOnly(List<Asset> assets) {
// Guard empty assets
if (assets.isEmpty) {
return RenderList([], null, []);
}
final elements = assets
.map(
(a) => RenderAssetGridElement(
RenderAssetGridElementType.assets,
date: a.fileCreatedAt,
),
)
.toList();
return RenderList(elements, null, assets);
}
bool get isEmpty => totalAssets == 0;
/// Loads the requested assets from the database to an internal buffer if not cached
@@ -332,7 +314,7 @@ class RenderList {
/// Deletes an asset from the render list and clears the buffer
/// This is only a workaround for deleted images still appearing in the gallery
Future<void> deleteAsset(Asset deleteAsset) async{
Future<void> deleteAsset(Asset deleteAsset) async {
allAssets?.remove(deleteAsset);
_buf.clear();
}
+4 -1
View File
@@ -179,10 +179,13 @@ class MapPage extends HookConsumerWidget {
return;
}
// Since we only have a single asset, we can just show GroupAssetBy.none
final renderList = await RenderList.fromAssets([asset], GroupAssetsBy.none,);
context.pushRoute(
GalleryViewerRoute(
initialIndex: 0,
renderList: RenderList.fromAssetsOnly([asset]),
renderList: renderList,
heroOffset: 0,
),
);