Skip to content

Commit 2910d02

Browse files
authored
Merge pull request #2661 from tnswo561412/main
Fix download progress exceeding 100%
2 parents 1368b24 + d17b880 commit 2910d02

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/providers/apps_provider.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import 'dart:async';
55
import 'dart:convert';
66
import 'dart:io';
77
import 'dart:math';
8+
import 'dart:ui';
89
import 'package:battery_plus/battery_plus.dart';
910
import 'package:fluttertoast/fluttertoast.dart';
1011
import 'package:crypto/crypto.dart';
@@ -438,7 +439,7 @@ Future<File> downloadFile(
438439
now.difference(lastProgressUpdate!) >=
439440
downloadUIUpdateInterval)) {
440441
progress = fullContentLength != null
441-
? (received / fullContentLength) * 100
442+
? clampDouble((received / fullContentLength) * 100, 0, 100)
442443
: 30;
443444
onProgress(progress);
444445
lastProgressUpdate = now;

0 commit comments

Comments
 (0)