|
@@ -19,6 +19,7 @@ class PersonFaceWidget extends StatelessWidget {
|
|
final EnteFile file;
|
|
final EnteFile file;
|
|
final String? personId;
|
|
final String? personId;
|
|
final int? clusterID;
|
|
final int? clusterID;
|
|
|
|
+ final bool useFullFile;
|
|
|
|
|
|
// PersonFaceWidget constructor checks that both personId and clusterID are not null
|
|
// PersonFaceWidget constructor checks that both personId and clusterID are not null
|
|
// and that the file is not null
|
|
// and that the file is not null
|
|
@@ -26,6 +27,7 @@ class PersonFaceWidget extends StatelessWidget {
|
|
this.file, {
|
|
this.file, {
|
|
this.personId,
|
|
this.personId,
|
|
this.clusterID,
|
|
this.clusterID,
|
|
|
|
+ this.useFullFile = true,
|
|
Key? key,
|
|
Key? key,
|
|
}) : assert(
|
|
}) : assert(
|
|
personId != null || clusterID != null,
|
|
personId != null || clusterID != null,
|
|
@@ -176,6 +178,13 @@ class PersonFaceWidget extends StatelessWidget {
|
|
faceCropCache.put(face.faceID, data);
|
|
faceCropCache.put(face.faceID, data);
|
|
return data;
|
|
return data;
|
|
}
|
|
}
|
|
|
|
+ if (!useFullFile) {
|
|
|
|
+ final Uint8List? cachedFaceThumbnail =
|
|
|
|
+ faceCropThumbnailCache.get(face.faceID);
|
|
|
|
+ if (cachedFaceThumbnail != null) {
|
|
|
|
+ return cachedFaceThumbnail;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
EnteFile? fileForFaceCrop = file;
|
|
EnteFile? fileForFaceCrop = file;
|
|
if (face.fileID != file.uploadedFileID!) {
|
|
if (face.fileID != file.uploadedFileID!) {
|
|
fileForFaceCrop =
|
|
fileForFaceCrop =
|
|
@@ -191,12 +200,17 @@ class PersonFaceWidget extends StatelessWidget {
|
|
{
|
|
{
|
|
face.faceID: face.detection.box,
|
|
face.faceID: face.detection.box,
|
|
},
|
|
},
|
|
|
|
+ useFullFile: useFullFile,
|
|
),
|
|
),
|
|
);
|
|
);
|
|
final Uint8List? computedCrop = result?[face.faceID];
|
|
final Uint8List? computedCrop = result?[face.faceID];
|
|
if (computedCrop != null) {
|
|
if (computedCrop != null) {
|
|
- faceCropCache.put(face.faceID, computedCrop);
|
|
|
|
- faceCropCacheFile.writeAsBytes(computedCrop).ignore();
|
|
|
|
|
|
+ if (useFullFile) {
|
|
|
|
+ faceCropCache.put(face.faceID, computedCrop);
|
|
|
|
+ faceCropCacheFile.writeAsBytes(computedCrop).ignore();
|
|
|
|
+ } else {
|
|
|
|
+ faceCropThumbnailCache.put(face.faceID, computedCrop);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
return computedCrop;
|
|
return computedCrop;
|
|
} catch (e, s) {
|
|
} catch (e, s) {
|