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