Since v0.40.0, touch event `MoveUpdate` cannot be called continuously after tap
Hi, thanks to your awesome chart package.
Since v0.40.0, touch event MoveUpdate cannot be called continuously after tap(= required longPress).
Difference in behavior is here.
| v0.36.4 | v0.40.0~ |
|---|---|
![]() |
![]() |
Is the behavior expected?
I think, it's change is not good for users. Some users cannot aware that the chart enable for them to trace line and show tooltip because of need to wait for certain amount of time. Therefore, I would like to revert to v0.36.0 behavior.
To Reproduce
Just use line_chart_sample_1.dart
https://github.com/imaNNeoFighT/fl_chart/blob/master/example/lib/line_chart/samples/line_chart_sample1.dart
Thanks.
I suggest we have a flag for this, to set the long press to be true or false. user are not mostly aware that they need to longPress
Found a fix for it, Not the best practice but you'll need to edit the package.
Goto lib/src/chart/base/base_chart/render_base_chart.dart
then update line 72 to this:

_longPressGestureRecognizer = LongPressGestureRecognizer(duration: const Duration(milliseconds: 0));
The trick is, it sets the LongPressGestureRecognizer.duration to be 0 milliseconds instead of 500 from kLongPressTimeout.
Suggestion to the dev team is to make this a feature flag so people can enable or disable LongPress feature
@Divinoart
Hi, thanks for your response.
I suggest we have a flag for this, to set the long press to be true or false.
Your approach is better, so I agree with you.
@Divinoart
_longPressGestureRecognizer = LongPressGestureRecognizer(duration: const Duration(milliseconds: 0)); The trick is, it sets the LongPressGestureRecognizer.duration to be 0 milliseconds instead of 500 from kLongPressTimeout.
Good Job👍 Your solution works expected behavior.
_longPressGestureRecognizer = LongPressGestureRecognizer(duration: Duration.zero);
| Duration.zero(v0.55.1) |
|---|
![]() |
Great!
Added longPressDuration optional property.
https://github.com/HTsuruo/fl_chart/tree/feature/tsuruo/enable-customize-longpress-duration
I hesitated that whether optional property should take a boolean true/false or duration, but finally decided that Duration property because it's better for flexibility.
LineTouchData(
handleBuiltInTouches: true,
touchTooltipData: LineTouchTooltipData(
tooltipBgColor: Colors.blueGrey.withOpacity(0.8),
),
// Here is additional property.
// You can customize how long it takes for tooltips to appear.
longPressDuration: Duration.zero,
);
Resolved by #1128
Resolved by #1128
Thank you for contributing. It will be available in the next version soon.
0.60.0 is just released. Check it out!


