Schwusch / widget_arrows

Draw arrows between widgets in Flutter
https://pub.dev/packages/widget_arrows
MIT License
145 stars 14 forks source link

Arrows misbehave when swiping in a PageView #16

Open kaciula opened 1 year ago

kaciula commented 1 year ago

Thank you for this very useful widget.

The issue I am experiencing is that inside a PageView, when I swipe to a different page, the arrows act weird. They stay in the same position although the page swipes to the left/right.

Schwusch commented 1 year ago

Hi, do you have a minimal example for reproducing the bug?

kaciula commented 1 year ago

@Schwusch Unfortunately, I have the code in a big project. How I worked around it is to detect PageView movement and hide arrows while the swiping is in progress.

Schwusch commented 1 year ago

In the latest version, it can make a big difference where in the hierarchy the ArrowContainer is placed. You can try moving it closer or further away from the arrow elements depending on your needs.

sircambridge commented 1 year ago

this is a really cool plugin!!!

im having a similar issue - i think when the arrow start and end are very far away from each other in the hierarchy, sometimes the arrow renderer doesnt find the target, even though both are inside the same arrow container.

im also dynamically generating arrow start and endpoints, and calling setstate, and they are in different scrollcontainers.

i cant really tell how the plugin works. is there a way i can manually trigger a arrow render by notifying the change listener or something? again - thanks for this really cool plugin!

Schwusch commented 1 year ago

I've come to notice, it does not work in lazily rendered Widgets, i.e. ListView, where Widgets are not laid out until shown on screen.

Thus, it is not possible to calculate where the arrows should be drawn if the connected elements aren't both on screen simultaneously.

Schwusch commented 1 year ago

@kaciula I had the same problem with arrows not moving, but in a vertical list. I added an optional list of Listenable as argument to the ArrowContainer constructor, where you can pass e.g. a PageController or ScrollController. It seems to work for me, so I'll put up a patch and release a new version soon.

Schwusch commented 1 year ago

Version 0.5.0 is published, and it should work better now with scrollable widgets.

Schwusch commented 1 year ago

@sircambridge You can pass both scrollcontrollers to ArrowContainer:

ArrowContainer(
  listenables: [scrollController1, scrollController2],
  child: YourWidget(),
);
leithalnajjar commented 1 year ago

I'm having a problem with InteractiveViewer

when zoom in and zoom out