improve progress display

This commit is contained in:
wgh19
2024-05-31 18:39:28 +08:00
parent 6a95fb37ed
commit 5e53c57755
2 changed files with 48 additions and 32 deletions

View File

@@ -158,7 +158,8 @@
"Add to favorites": "添加收藏",
"Follow the artist": "关注画师",
"Manga": "漫画",
"Actions": "操作"
"Actions": "操作",
"Current quantity": "当前数量"
},
"zh_TW": {
"Search": "搜索",
@@ -319,6 +320,7 @@
"Add to favorites": "添加收藏",
"Follow the artist": "關注畫師",
"Manga": "漫畫",
"Actions": "操作"
"Actions": "操作",
"Current quantity": "當前數量"
}
}

View File

@@ -15,7 +15,10 @@ class BatchDownloadButton extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Button(
child: const Icon(MdIcons.download, size: 20,),
child: const Icon(
MdIcons.download,
size: 20,
),
onPressed: () {
showDialog(
context: context,
@@ -40,6 +43,8 @@ class _DownloadDialog extends StatefulWidget {
class _DownloadDialogState extends State<_DownloadDialog> {
int maxCount = 30;
int currentCount = 0;
bool loading = false;
bool cancel = false;
@@ -53,8 +58,11 @@ class _DownloadDialogState extends State<_DownloadDialog> {
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('${"Maximum number of downloads".tl}:'),
const SizedBox(height: 16,),
if (!loading) Text('${"Maximum number of downloads".tl}:'),
if (loading) Text("${"Current quantity".tl}: $currentCount"),
const SizedBox(
height: 16,
),
SizedBox(
height: 42,
width: 196,
@@ -71,19 +79,23 @@ class _DownloadDialogState extends State<_DownloadDialog> {
largeChange: 30,
clearButton: false,
),
)
),
],
).paddingVertical(8),
),
actions: [
Button(child: Text("Cancel".tl), onPressed: () {
Button(
child: Text("Cancel".tl),
onPressed: () {
cancel = true;
context.pop();
}),
if (!loading)
FilledButton(onPressed: load, child: Text("Continue".tl))
else
FilledButton(onPressed: (){}, child: const SizedBox(
FilledButton(
onPressed: () {},
child: const SizedBox(
height: 20,
width: 64,
child: Center(
@@ -130,15 +142,17 @@ class _DownloadDialogState extends State<_DownloadDialog> {
continue;
}
all.addAll(res.data);
setState(() {
currentCount = all.length;
});
nextUrl = res.subData ?? "end";
}
int i = 0;
for (var illust in all) {
if(i > maxCount) return;
if (i > maxCount) break;
DownloadManager().addDownloadingTask(illust);
i++;
}
context.pop();
}
}