mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
fix(mobile): memory lane rebuild (#21350)
* avoid unnecessary timeline rebuild * add key * handle disabled memories * avoid rebuild if no memories
This commit is contained in:
parent
dc6ac3aaec
commit
a5841a8bf4
4 changed files with 24 additions and 28 deletions
|
|
@ -7,15 +7,20 @@ import 'package:immich_mobile/presentation/widgets/images/thumbnail.widget.dart'
|
|||
import 'package:immich_mobile/providers/asset_viewer/video_player_value_provider.dart';
|
||||
import 'package:immich_mobile/providers/haptic_feedback.provider.dart';
|
||||
import 'package:immich_mobile/providers/infrastructure/asset_viewer/current_asset.provider.dart';
|
||||
import 'package:immich_mobile/providers/infrastructure/memory.provider.dart';
|
||||
import 'package:immich_mobile/routing/router.dart';
|
||||
|
||||
class DriftMemoryLane extends ConsumerWidget {
|
||||
final List<DriftMemory> memories;
|
||||
|
||||
const DriftMemoryLane({super.key, required this.memories});
|
||||
const DriftMemoryLane({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final memoryLaneProvider = ref.watch(driftMemoryFutureProvider);
|
||||
final memories = memoryLaneProvider.value ?? const [];
|
||||
if (memories.isEmpty) {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
|
||||
return ConstrainedBox(
|
||||
constraints: const BoxConstraints(maxHeight: 200),
|
||||
child: CarouselView(
|
||||
|
|
@ -38,7 +43,9 @@ class DriftMemoryLane extends ConsumerWidget {
|
|||
|
||||
context.pushRoute(DriftMemoryRoute(memories: memories, memoryIndex: index));
|
||||
},
|
||||
children: memories.map((memory) => DriftMemoryCard(memory: memory)).toList(),
|
||||
children: memories
|
||||
.map((memory) => DriftMemoryCard(key: Key(memory.id), memory: memory))
|
||||
.toList(growable: false),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue