embraceitmobile / animated_tree_view

Animated TreeView based on AnimatedList allows building fully customizable Nodes that can be nested to infinite levels and children.
https://pub.dev/packages/animated_tree_view
MIT License
59 stars 29 forks source link

Preventing scrolling to last visible child when expansion behaviour is none #28

Closed busslina closed 1 month ago

busslina commented 11 months ago

On handleAddItemsEvent and handleInsertItemsEvent events

busslina commented 11 months ago

Now I can achieve my desired behavior:

Video_2023_10_14-1.webm

Now it really snaps to top. I use none and manipulate the controller by myself.

With the ...snapToTop it was scrolling down, then up.

With all the respect this lib is a mess in scrolling behaviour...

jawwad-hassan89 commented 11 months ago

Thanks for pointing out this issue, will look into it this weekend.

busslina commented 11 months ago

This is a easy patch. But sure you can get resolve it better although you know all the code design

jawwad-hassan89 commented 11 months ago

I have fixed this issue by adding a new boolean flag focusToNewNode. By setting the flag to false, the scrolling to the last child is disabled. As the issue you reported is not directly related to the expansion behaviour, and the disabling the sccrollingToLastChild might not be desirable by all the users, so it made sense to separate out this functionality.

Pull request 32 awaiting approval