flutter / flutter/devtools

Flame chart - jumpTo called before scroll position offsets have new size

Open
#2,012 7 comments 0 reactions 0 assignees View on GitHub
cost: medium flame_chart P2 screen: cpu profiler
Dominant language
Dart
Stars
1.7k
Forks
404
Avg merge
6d 17h
Merged PRs (30d)
18

Description

In flame_chart.dart, we call
```
linkedHorizontalScrollControllerGroup.jumpTo(newScrollOffset);
```
to update the scroll offset as we zoom. We call this inside of an animation controller listener `zoomController.addListener(() { ... })`. At times when we call this, `scrollController.position.maxScrollOffset` is not updated for the new zoom level and layout size, causing `jumpTo` to fire BallisticScrollActivities to bounce the scroll offset back to what it thinks is the `maxScrollOffset`.

We need to have a way to call `jumpTo` when we can guarantee that the min / max scroll offsets are updated for the new zoom value.

I attempted to set these offsets manually using `scrollController.position.applyContentDimensions(minScrollOffset, maxScrollOffset)` but this results in an error regarding gesture detectors: `The replaceGestureRecognizers() method can only be called during the layout phase.`

Contributor guide

Open the contributing guide

Research direction

Start in flame_chart.dart at the zoomController listener and the linkedHorizontalScrollControllerGroup.jumpTo(newScrollOffset) call. Reproduce zooming near a scroll boundary, then verify that jumpTo runs only after the new min/max scroll offsets are available, without triggering ballistic bounce or the gesture-detector layout error.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, flutter
Domain
data-visualization, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.