From 53799dcc9a5d96c1142b1504571493c878cf1731 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Elias=20M=C3=BCller?= <elias@elias-mueller.com>
Date: Thu, 11 May 2023 21:09:03 +0200
Subject: [PATCH] Fix download progress bar not hiding when complete

---
 lib/screen/pages/files/fileElement.dart | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/lib/screen/pages/files/fileElement.dart b/lib/screen/pages/files/fileElement.dart
index 681b411..25ab9c6 100644
--- a/lib/screen/pages/files/fileElement.dart
+++ b/lib/screen/pages/files/fileElement.dart
@@ -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;
+            });
           });
 
         }