widget_arrows icon indicating copy to clipboard operation
widget_arrows copied to clipboard

Arrows misbehave when swiping in a PageView

Open kaciula opened this issue 3 years ago • 9 comments

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.

kaciula avatar Feb 01 '23 16:02 kaciula

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

Schwusch avatar Feb 11 '23 08:02 Schwusch

@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.

kaciula avatar Feb 11 '23 08:02 kaciula

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.

Schwusch avatar Feb 11 '23 08:02 Schwusch

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!

sircambridge avatar Feb 17 '23 01:02 sircambridge

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 avatar Feb 21 '23 18:02 Schwusch

@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 avatar Feb 25 '23 07:02 Schwusch

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

Schwusch avatar Feb 25 '23 12:02 Schwusch

@sircambridge You can pass both scrollcontrollers to ArrowContainer:

ArrowContainer(
  listenables: [scrollController1, scrollController2],
  child: YourWidget(),
);

Schwusch avatar Feb 25 '23 12:02 Schwusch

I'm having a problem with InteractiveViewer

when zoom in and zoom out

leithalnajjar avatar Mar 20 '23 07:03 leithalnajjar