Resolve object tags for local files as well
This commit is contained in:
parent
e53581603c
commit
fb0042ae03
2 changed files with 13 additions and 2 deletions
|
@ -14,8 +14,8 @@ class ObjectTagsWidget extends StatelessWidget {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return FutureBuilder<List<String>>(
|
||||
future: getThumbnailFromServer(file).then((data) {
|
||||
return ObjectDetectionService.instance.predict(data);
|
||||
future: getThumbnail(file).then((data) {
|
||||
return ObjectDetectionService.instance.predict(data!);
|
||||
}),
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.hasData) {
|
||||
|
|
|
@ -32,6 +32,17 @@ class FileDownloadItem {
|
|||
FileDownloadItem(this.file, this.completer, this.cancelToken, this.counter);
|
||||
}
|
||||
|
||||
Future<Uint8List?> getThumbnail(File file) async {
|
||||
if (file.isRemoteFile) {
|
||||
return getThumbnailFromServer(file);
|
||||
} else {
|
||||
return getThumbnailFromLocal(
|
||||
file,
|
||||
size: thumbnailLargeSize,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Future<Uint8List> getThumbnailFromServer(File file) async {
|
||||
final cachedThumbnail = cachedThumbnailPath(file);
|
||||
if (await cachedThumbnail.exists()) {
|
||||
|
|
Loading…
Add table
Reference in a new issue