diff --git a/mobile/lib/shared/ui/hooks/blurhash_hook.dart b/mobile/lib/shared/ui/hooks/blurhash_hook.dart index 91aa052f1d..24b3c25e13 100644 --- a/mobile/lib/shared/ui/hooks/blurhash_hook.dart +++ b/mobile/lib/shared/ui/hooks/blurhash_hook.dart @@ -1,18 +1,17 @@ import 'dart:convert'; import 'dart:typed_data'; -import 'package:flutter/material.dart'; import 'package:flutter_hooks/flutter_hooks.dart'; import 'package:immich_mobile/shared/models/asset.dart'; import 'package:thumbhash/thumbhash.dart' as thumbhash; -ValueNotifier useBlurHashState(Asset? asset) { +ObjectRef useBlurHashRef(Asset? asset) { if (asset?.thumbhash == null) { - return useState(null); + return useRef(null); } final rbga = thumbhash.thumbHashToRGBA( base64Decode(asset!.thumbhash!), ); - return useState(thumbhash.rgbaToBmp(rbga)); + return useRef(thumbhash.rgbaToBmp(rbga)); } diff --git a/mobile/lib/shared/ui/immich_thumbnail.dart b/mobile/lib/shared/ui/immich_thumbnail.dart index 92d0ba30f3..fe35bdaac2 100644 --- a/mobile/lib/shared/ui/immich_thumbnail.dart +++ b/mobile/lib/shared/ui/immich_thumbnail.dart @@ -23,13 +23,10 @@ class ImmichThumbnail extends HookWidget { final double height; final BoxFit fit; - // Helper function to return the image provider for the asset - // either by using the asset ID or the asset itself + /// Helper function to return the image provider for the asset thumbnail + /// either by using the asset ID or the asset itself /// [asset] is the Asset to request, or else use [assetId] to get a remote /// image provider - /// Use [isThumbnail] and [thumbnailSize] if you'd like to request a thumbnail - /// The size of the square thumbnail to request. Ignored if isThumbnail - /// is not true static ImageProvider imageProvider({ Asset? asset, String? assetId, @@ -64,7 +61,7 @@ class ImmichThumbnail extends HookWidget { @override Widget build(BuildContext context) { - Uint8List? blurhash = useBlurHashState(asset).value; + Uint8List? blurhash = useBlurHashRef(asset).value; if (asset == null) { return Container( color: Colors.grey,