mirror of
https://github.com/immich-app/immich.git
synced 2025-08-11 09:16:31 -04:00
* chore: bump dart sdk to 3.8 * chore: make build * make pigeon * chore: format files --------- Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
27 lines
780 B
Dart
27 lines
780 B
Dart
import 'dart:convert';
|
|
import 'dart:typed_data';
|
|
import 'package:flutter_hooks/flutter_hooks.dart';
|
|
import 'package:immich_mobile/domain/models/asset/base_asset.model.dart';
|
|
import 'package:immich_mobile/entities/asset.entity.dart';
|
|
import 'package:thumbhash/thumbhash.dart' as thumbhash;
|
|
|
|
ObjectRef<Uint8List?> useBlurHashRef(Asset? asset) {
|
|
if (asset?.thumbhash == null) {
|
|
return useRef(null);
|
|
}
|
|
|
|
final rbga = thumbhash.thumbHashToRGBA(base64Decode(asset!.thumbhash!));
|
|
|
|
return useRef(thumbhash.rgbaToBmp(rbga));
|
|
}
|
|
|
|
ObjectRef<Uint8List?> useDriftBlurHashRef(RemoteAsset? asset) {
|
|
if (asset?.thumbHash == null) {
|
|
return useRef(null);
|
|
}
|
|
|
|
final rbga = thumbhash.thumbHashToRGBA(base64Decode(asset!.thumbHash!));
|
|
|
|
return useRef(thumbhash.rgbaToBmp(rbga));
|
|
}
|