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>
19 lines
718 B
Dart
19 lines
718 B
Dart
import 'dart:typed_data';
|
|
import 'dart:ui';
|
|
|
|
import 'package:photo_manager/photo_manager.dart';
|
|
|
|
class AssetMediaRepository {
|
|
const AssetMediaRepository();
|
|
|
|
Future<Uint8List?> getThumbnail(String id, {int quality = 80, Size size = const Size.square(256)}) => AssetEntity(
|
|
id: id,
|
|
// The below fields are not used in thumbnailDataWithSize but are required
|
|
// to create an AssetEntity instance. It is faster to create a dummy AssetEntity
|
|
// instance than to fetch the asset from the device first.
|
|
typeInt: AssetType.image.index,
|
|
width: size.width.toInt(),
|
|
height: size.height.toInt(),
|
|
).thumbnailDataWithSize(ThumbnailSize(size.width.toInt(), size.height.toInt()), quality: quality);
|
|
}
|