From 59b2389631270b03292aa5c81a00db83d13f01df Mon Sep 17 00:00:00 2001 From: Enbiya Olgun <78034913+NBA2K1@users.noreply.github.com> Date: Tue, 22 Apr 2025 03:23:12 +0200 Subject: [PATCH] Fix Exception MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ``` ════════ Exception caught by widgets library ═══════════════════════════════════ The following UnsupportedError was thrown building CircularProgressIndicator(100.0%, dependencies: [InheritedCupertinoTheme, _InheritedTheme, _LocalizationsScope-[GlobalKey#3b6da]], state: _CircularProgressIndicatorState#8c03b(ticker inactive)): Unsupported operation: Infinity or NaN toInt The relevant error-causing widget was: CircularProgressIndicator CircularProgressIndicator (package:mangayomi/modules/manga/reader/widgets/circular_progress_indicator_animate_rotate.dart:56:27) ``` --- .../circular_progress_indicator_animate_rotate.dart | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/modules/manga/reader/widgets/circular_progress_indicator_animate_rotate.dart b/lib/modules/manga/reader/widgets/circular_progress_indicator_animate_rotate.dart index 3fe2de49..08c729ea 100644 --- a/lib/modules/manga/reader/widgets/circular_progress_indicator_animate_rotate.dart +++ b/lib/modules/manga/reader/widgets/circular_progress_indicator_animate_rotate.dart @@ -51,9 +51,13 @@ class _CircularProgressIndicatorAnimateRotateState duration: const Duration(milliseconds: 500), curve: Curves.easeInOut, tween: Tween(begin: 0, end: widget.progress), - builder: - (context, value, _) => - CircularProgressIndicator(value: value), + builder: (context, value, _) { + final safeValue = + value.isNaN || value.isInfinite + ? null + : value.clamp(0.0, 1.0); + return CircularProgressIndicator(value: safeValue); + }, ), ), );