Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chart can't move when inside a PageView #102

Closed
khanhnguyen-96 opened this issue May 21, 2020 · 4 comments
Closed

Chart can't move when inside a PageView #102

khanhnguyen-96 opened this issue May 21, 2020 · 4 comments

Comments

@khanhnguyen-96
Copy link

khanhnguyen-96 commented May 21, 2020

If a chart is inside a PageView, swiping horizontally does not move the chart but instead moving the PageView.
Steps to reproduce:
1: Create a chart inside a PageView. This PageView should have more than 2 pages.
2: Pinch the chart to zoom in
3: Drag the chart to move but can't. If you drag vertically then switch to horizontally, the chart can move normally. However, If you try to move it horizontally first, it will not work.

@SunPointed
Copy link
Owner

Try this days but not work, any ideas?

@khanhnguyen-96
Copy link
Author

Try this days but not work, any ideas?

I think this has something to do with the OptimizedGestureDetector library because every time the chart's horizontal drag gesture enters the gesture arena always ended with a loss. My temporary workaround will be wrapping the chart in a new GestureDetector and use the painter to translate the chart. But the downside to this is I was not able to fling the chart.

@SunPointed
Copy link
Owner

I try to modify the OptimizedGestureDetector which have multiple GestureRecognizers but only one GestureRecognizer can win in arena, I don't find a solution which can let all GestureRecognizers(all belong to OptimizedGestureDetector ) win together

@SunPointed
Copy link
Owner

finally I find a solution in version 0.2.1, you can see the Scrolling Charts's View Pager Demo to see how to solve this. Though Its worked, it is not perfect yet. The reason is below
I add resolveGestureHorizontalConflict and resolveGestureVerticalConflict to controller to solve chart gesture miss in scrollable views, but set these value to true means in chart area scrollable views will miss gestures. After read a lot about the gesture in flutter, not yet find a solution that can control nest scroll like android fragment in viewpager(when child scroll to the edge the scroll can pass to parent and parent can begin scroll)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants