fix download

This commit is contained in:
wgh19
2024-05-14 18:10:30 +08:00
parent 9ba859d668
commit 07ff6d9526
5 changed files with 37 additions and 21 deletions

View File

@@ -74,11 +74,6 @@ class _IllustPageState extends State<IllustPage> {
}
Widget buildImage(double width, double height, int index) {
File? downloadFile;
if(widget.illust.downloaded) {
downloadFile = DownloadManager().getImage(widget.illust.id, index);
}
if (index == 0) {
return Text(
widget.illust.title,
@@ -86,6 +81,10 @@ class _IllustPageState extends State<IllustPage> {
).paddingVertical(8).paddingHorizontal(12);
}
index--;
File? downloadFile;
if(widget.illust.downloaded) {
downloadFile = DownloadManager().getImage(widget.illust.id, index);
}
if (index == widget.illust.images.length) {
return const SizedBox(
height: _kBottomBarHeight,
@@ -107,6 +106,7 @@ class _IllustPageState extends State<IllustPage> {
? widget.illust.images[index].original
: "file://${downloadFile.path}"),
child: Image(
key: ValueKey(index),
image: downloadFile == null
? CachedImageProvider(widget.illust.images[index].large) as ImageProvider
: FileImage(downloadFile) as ImageProvider,