From 396487b5438c45607133a8223de93fcf0449df29 Mon Sep 17 00:00:00 2001 From: behnam-deriv <133759298+behnam-deriv@users.noreply.github.com> Date: Mon, 9 Mar 2026 19:20:54 +0800 Subject: [PATCH] fix: quote bound animation for disjoint price range --- lib/src/deriv_chart/chart/basic_chart.dart | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/lib/src/deriv_chart/chart/basic_chart.dart b/lib/src/deriv_chart/chart/basic_chart.dart index db7737ee2..637f72cad 100644 --- a/lib/src/deriv_chart/chart/basic_chart.dart +++ b/lib/src/deriv_chart/chart/basic_chart.dart @@ -322,14 +322,31 @@ class BasicChartState extends State maxQuote += 2; } - if (!minQuote.isNaN && minQuote != bottomBoundQuoteTarget) { + if (minQuote.isNaN || maxQuote.isNaN) { + return; + } + + // Snap bounds and skip tick animation when switching to a market with a + // disjoint price range, to avoid a long vertical-line artifact. + final bool rangeDisjoint = + maxQuote < bottomBoundQuoteTarget || minQuote > topBoundQuoteTarget; + if (rangeDisjoint) { + bottomBoundQuoteTarget = minQuote; + bottomBoundQuoteAnimationController.value = minQuote; + topBoundQuoteTarget = maxQuote; + topBoundQuoteAnimationController.value = maxQuote; + completeCurrentTickAnimation(); + return; + } + + if (minQuote != bottomBoundQuoteTarget) { bottomBoundQuoteTarget = minQuote; bottomBoundQuoteAnimationController.animateTo( bottomBoundQuoteTarget, curve: Curves.easeOut, ); } - if (!maxQuote.isNaN && maxQuote != topBoundQuoteTarget) { + if (maxQuote != topBoundQuoteTarget) { topBoundQuoteTarget = maxQuote; topBoundQuoteAnimationController.animateTo( topBoundQuoteTarget,