mirror of
https://github.com/immich-app/immich.git
synced 2025-07-31 15:08:44 -04:00
hero tag in tile key
This commit is contained in:
parent
e154240335
commit
9a0e9a4973
@ -111,20 +111,9 @@ class _FixedSegmentRow extends ConsumerWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
final timelineService = ref.read(timelineServiceProvider);
|
final timelineService = ref.read(timelineServiceProvider);
|
||||||
|
|
||||||
if (timelineService.hasRange(assetIndex, assetCount)) {
|
|
||||||
return _buildAssetRow(context, timelineService.getAssets(assetIndex, assetCount), timelineService);
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final assets = timelineService.getAssets(assetIndex, assetCount);
|
final assets = timelineService.getAssets(assetIndex, assetCount);
|
||||||
return FutureBuilder<List<BaseAsset>>(
|
return _buildAssetRow(context, assets, timelineService);
|
||||||
future: null,
|
|
||||||
initialData: assets,
|
|
||||||
builder: (context, snapshot) {
|
|
||||||
return _buildAssetRow(context, snapshot.data, timelineService);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return FutureBuilder<List<BaseAsset>>(
|
return FutureBuilder<List<BaseAsset>>(
|
||||||
future: timelineService.loadAssets(assetIndex, assetCount),
|
future: timelineService.loadAssets(assetIndex, assetCount),
|
||||||
@ -136,18 +125,26 @@ class _FixedSegmentRow extends ConsumerWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildAssetRow(BuildContext context, List<BaseAsset>? assets, TimelineService timelineService) {
|
Widget _buildAssetRow(BuildContext context, List<BaseAsset>? assets, TimelineService timelineService) {
|
||||||
|
final assetCount = this.assetCount;
|
||||||
|
final assetIndex = this.assetIndex;
|
||||||
|
final row = List.filled(assetCount, const _AssetTileWidget(asset: null, assetIndex: 0));
|
||||||
|
if (assets != null) {
|
||||||
|
for (int i = 0; i < row.length; i++) {
|
||||||
|
final curAssetIndex = assetIndex + i;
|
||||||
|
final asset = assets[i];
|
||||||
|
row[i] = _AssetTileWidget(
|
||||||
|
key: ValueKey(asset.heroTag.hashCode ^ curAssetIndex.hashCode ^ timelineService.hashCode),
|
||||||
|
asset: assets[i],
|
||||||
|
assetIndex: curAssetIndex,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return FixedTimelineRow(
|
return FixedTimelineRow(
|
||||||
dimension: tileHeight,
|
dimension: tileHeight,
|
||||||
spacing: spacing,
|
spacing: spacing,
|
||||||
textDirection: Directionality.of(context),
|
textDirection: Directionality.of(context),
|
||||||
children: [
|
children: row,
|
||||||
for (int i = 0; i < assetCount; i++)
|
|
||||||
_AssetTileWidget(
|
|
||||||
key: ValueKey(i.hashCode ^ (assetIndex + i).hashCode ^ timelineService.hashCode),
|
|
||||||
asset: assets == null ? null : assets[i],
|
|
||||||
assetIndex: assetIndex + i,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user