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,

View File

@@ -53,9 +53,9 @@ class _ImagePageState extends State<ImagePage> with WindowListener{
@override
Widget build(BuildContext context) {
return ColoredBox(
color: FluentTheme.of(context).micaBackgroundColor.withOpacity(1),
child: Stack(
return ScaffoldPage(
padding: EdgeInsets.only(top: MediaQuery.of(context).padding.top),
content: Stack(
children: [
Positioned.fill(child: PhotoView(
backgroundDecoration: const BoxDecoration(
@@ -82,7 +82,8 @@ class _ImagePageState extends State<ImagePage> with WindowListener{
const Expanded(
child: DragToMoveArea(child: SizedBox.expand(),),
),
WindowButtons(key: ValueKey(windowButtonKey),),
if(App.isDesktop)
WindowButtons(key: ValueKey(windowButtonKey),),
],
),
),