imaNNeo / imaNNeo/fl_chart

LineChart inside PageView breaks the pan gesture.

Open
#202 6 comments 4 reactions 0 assignees View on GitHub
enhancement Fundamental
Dominant language
Dart
Stars
7.6k
Forks
2k
Avg merge
9d 1h
Merged PRs (30d)
2

Description

In the example project, `LineChart` doesn't change the tooltip when dragging through the widget.
This is because `PageView` is using a `HorizontalDragGestureRecognizer` that has priority to the `PanGestureRecognizer` that is used on the `LineChart`(the gesture detector widget with onPanStart...)

My proposal is to add:

onHorizontalDragDown
onHorizontalDragStart
onHorizontalDragUpdate
onHorizontalDragEnd
onHorizontalDragCancel

with the same params as

onPanDown
onPanStart
onPanUpdate
onPanEnd
onPanCancel

This will make the LineChart have priority to the PageView.

To make it more adaptable we could add the param `draggable:bool` to `LineTouchData` in case people want to disable the pan gesture to prioritize other gestures in the Gesture Arena.

Let me know what you think and I can do a pull request

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue in the example project with a LineChart inside a PageView, then read the LineChart touch handling around LineTouchData and its pan gesture callbacks. Compare the proposed horizontal drag callbacks and draggable option with Flutter's gesture arena behavior. Done means dragging changes the LineChart tooltip correctly inside PageView without preventing an opt-out for competing gestures.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, flutter
Domain
mobile
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.