diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 659ce6701..7690e1a9e 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -27,6 +27,9 @@ dev_dependencies: sdk: flutter intl_utils: ^2.8.2 +dependency_overrides: + intl: 0.20.2 + flutter: uses-material-design: true diff --git a/lib/src/deriv_chart/chart/main_chart.dart b/lib/src/deriv_chart/chart/main_chart.dart index 54c050867..e729aef57 100644 --- a/lib/src/deriv_chart/chart/main_chart.dart +++ b/lib/src/deriv_chart/chart/main_chart.dart @@ -399,6 +399,11 @@ class _ChartImplementationState extends BasicChartState { @override Widget build(BuildContext context) => LayoutBuilder( + // Force remount when markerSeries changes. + // LayoutBuilder only re-invokes its builder on constraint changes; + // without a key that tracks markerSeries identity, the old + // MarkerArea subtree persists after trade-type switches. + key: ObjectKey(widget.markerSeries), builder: (BuildContext context, BoxConstraints constraints) { final XAxisModel xAxis = context.watch(); @@ -579,17 +584,20 @@ class _ChartImplementationState extends BasicChartState { ), ); - Widget _buildMarkerArea() => MultipleAnimatedBuilder( - animations: [ - currentTickAnimation, - topBoundQuoteAnimationController, - bottomBoundQuoteAnimationController - ], - builder: (BuildContext context, _) => MarkerArea( - markerSeries: widget.markerSeries!, - quoteToCanvasY: chartQuoteToCanvasY, - animationInfo: AnimationInfo( - currentTickPercent: currentTickAnimation.value, + Widget _buildMarkerArea() => KeyedSubtree( + key: ObjectKey(widget.markerSeries), + child: MultipleAnimatedBuilder( + animations: [ + currentTickAnimation, + topBoundQuoteAnimationController, + bottomBoundQuoteAnimationController + ], + builder: (BuildContext context, _) => MarkerArea( + markerSeries: widget.markerSeries!, + quoteToCanvasY: chartQuoteToCanvasY, + animationInfo: AnimationInfo( + currentTickPercent: currentTickAnimation.value, + ), ), ), ); diff --git a/pubspec.yaml b/pubspec.yaml index edbb1a336..35f31e91b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -17,7 +17,7 @@ dependencies: collection: ^1.18.0 deriv_technical_analysis: ^1.1.1 equatable: ^2.0.5 - intl: ^0.19.0 + intl: ^0.20.2 json_annotation: ^4.8.0 provider: ^6.0.5 shared_preferences: ^2.1.0