@@ -2,15 +2,17 @@ import 'dart:typed_data';
22
33import 'package:flutter/material.dart' ;
44import 'package:flutter_hooks/flutter_hooks.dart' ;
5+ import 'package:hooks_riverpod/hooks_riverpod.dart' ;
56import 'package:immich_mobile/providers/image/immich_local_thumbnail_provider.dart' ;
67import 'package:immich_mobile/providers/image/immich_remote_thumbnail_provider.dart' ;
78import 'package:immich_mobile/entities/asset.entity.dart' ;
89import 'package:immich_mobile/utils/hooks/blurhash_hook.dart' ;
910import 'package:immich_mobile/widgets/common/immich_image.dart' ;
1011import 'package:immich_mobile/widgets/common/thumbhash_placeholder.dart' ;
1112import 'package:octo_image/octo_image.dart' ;
13+ import 'package:immich_mobile/providers/user.provider.dart' ;
1214
13- class ImmichThumbnail extends HookWidget {
15+ class ImmichThumbnail extends HookConsumerWidget {
1416 const ImmichThumbnail ({
1517 this .asset,
1618 this .width = 250 ,
@@ -31,6 +33,7 @@ class ImmichThumbnail extends HookWidget {
3133 static ImageProvider imageProvider ({
3234 Asset ? asset,
3335 String ? assetId,
36+ String ? userId,
3437 int thumbnailSize = 256 ,
3538 }) {
3639 if (asset == null && assetId == null ) {
@@ -48,6 +51,7 @@ class ImmichThumbnail extends HookWidget {
4851 asset: asset,
4952 height: thumbnailSize,
5053 width: thumbnailSize,
54+ userId: userId,
5155 );
5256 } else {
5357 return ImmichRemoteThumbnailProvider (
@@ -59,8 +63,10 @@ class ImmichThumbnail extends HookWidget {
5963 }
6064
6165 @override
62- Widget build (BuildContext context) {
66+ Widget build (BuildContext context, WidgetRef ref ) {
6367 Uint8List ? blurhash = useBlurHashRef (asset).value;
68+ final userId = ref.watch (currentUserProvider)? .id;
69+
6470 if (asset == null ) {
6571 return Container (
6672 color: Colors .grey,
@@ -79,6 +85,7 @@ class ImmichThumbnail extends HookWidget {
7985 octoSet: blurHashOrPlaceholder (blurhash),
8086 image: ImmichThumbnail .imageProvider (
8187 asset: asset,
88+ userId: userId,
8289 ),
8390 width: width,
8491 height: height,
0 commit comments