From e095a470025512501155c9c901ad7f5b722ec768 Mon Sep 17 00:00:00 2001 From: wgh19 Date: Mon, 13 May 2024 22:47:34 +0800 Subject: [PATCH] update illust page --- lib/pages/illust_page.dart | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/lib/pages/illust_page.dart b/lib/pages/illust_page.dart index a1e63c5..1b210f1 100644 --- a/lib/pages/illust_page.dart +++ b/lib/pages/illust_page.dart @@ -94,11 +94,31 @@ class _IllustPageState extends State { height: imageHeight, child: GestureDetector( onTap: () => ImagePage.show(widget.illust.images[index].original), - child: AnimatedImage( - image: CachedImageProvider(widget.illust.images[index].medium), + child: Image( + image: CachedImageProvider(widget.illust.images[index].large), width: imageWidth, fit: BoxFit.cover, height: imageHeight, + loadingBuilder: (context, child, loadingProgress) { + if (loadingProgress == null) return child; + double? value; + if(loadingProgress.expectedTotalBytes != null) { + value = (loadingProgress.cumulativeBytesLoaded / + loadingProgress.expectedTotalBytes!)*100; + } + if(value != null && (value > 100 || value < 0)) { + value = null; + } + return Center( + child: SizedBox( + width: 24, + height: 24, + child: ProgressRing( + value: value, + ), + ), + ); + } ), ), );