From 9a9f539906ceffbf1dfd541a9b6fa0ce5e814da1 Mon Sep 17 00:00:00 2001 From: nyne Date: Tue, 2 Sep 2025 20:16:13 +0800 Subject: [PATCH] Disable cache when updating comic source. --- lib/pages/comic_source_page.dart | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/lib/pages/comic_source_page.dart b/lib/pages/comic_source_page.dart index 9235710..5c88e7d 100644 --- a/lib/pages/comic_source_page.dart +++ b/lib/pages/comic_source_page.dart @@ -43,7 +43,10 @@ class ComicSourcePage extends StatelessWidget { try { var res = await AppDio().get( source.url, - options: Options(responseType: ResponseType.plain), + options: Options( + responseType: ResponseType.plain, + headers: {"cache-time": "no"}, + ), ); if (cancel) return; controller?.close(); @@ -200,10 +203,7 @@ class _BodyState extends State<_Body> { ); } - void update( - ComicSource source, [ - bool showLoading = true, - ]) { + void update(ComicSource source, [bool showLoading = true]) { ComicSourcePage.update(source, showLoading); } @@ -304,7 +304,10 @@ class _BodyState extends State<_Body> { try { var res = await AppDio().get( url, - options: Options(responseType: ResponseType.plain), + options: Options( + responseType: ResponseType.plain, + headers: {"cache-time": "no"}, + ), ); if (cancel) return; controller.close(); @@ -710,11 +713,13 @@ class _CheckUpdatesButtonState extends State<_CheckUpdatesButton> { @override Widget build(BuildContext context) { return FilledButton.tonalIcon( - icon: isLoading ? SizedBox( - width: 18, - height: 18, - child: CircularProgressIndicator(strokeWidth: 2), - ) : Icon(Icons.update), + icon: isLoading + ? SizedBox( + width: 18, + height: 18, + child: CircularProgressIndicator(strokeWidth: 2), + ) + : Icon(Icons.update), label: Text("Check updates".tl), onPressed: check, );