Fix download progress bar not hiding when complete

This commit is contained in:
Elias Müller 2023-05-11 21:09:03 +02:00
parent fac4af85b0
commit 53799dcc9a

View File

@ -88,7 +88,6 @@ class _FileElementState extends State<FileElement> {
return Files(widget.path.toList()..add(widget.file.name));
},
));
//props.enterFolder(widget.file.name);
} else {
setState(() {
widget.file.currentlyDownloading = true;
@ -97,23 +96,21 @@ class _FileElementState extends State<FileElement> {
log("Download: ${widget.file.path} to ${widget.file.name}");
FileElement.download(widget.file.path, widget.file.name, (progress) {
setState(() => {
percent = progress,
});
setState(() => percent = progress);
}, (result) {
if(result.type != ResultType.done) {
showDialog(context: context, builder: (context) {
return AlertDialog(
title: Text("Download"),
title: const Text("Download"),
content: Text(result.message),
);
});
setState(() {
widget.file.currentlyDownloading = false;
percent = 0;
});
}
setState(() {
widget.file.currentlyDownloading = false;
percent = 0;
});
});
}