Closed DeepStyles closed 2 years ago
K for directional view, I can use draggable feature to drag any node which helps in mindmap kinda app tht exist in other platforms. I saw widget_ arrows package which kinda similar to this one, but don't hav draggable feature.
It might be something that can be done in force directed graph, I will see what can be done.
I was able to to it partially, but there are some bugs so might take time.
r u using stateful widgets with globlal key??(theres also draggable package on pub)
The problem is that I am setting the nodes position on my own. Have to adjust similarly
@DeepStyles have a look at version 0.6.0 . The example is also updated
nice had a peek, cant we drag the individual node (including arrow following around)???
Not sure what you mean. Did you look at the gif?
In the gif, it's dragging entire graph instead can we have options to drag individual nodes.
It is actually dragging individual nodes, after which the nodes around it moves according to repulsion
Instead of nodes around moving can't we have just connections moving when we drag related node.
Best if you give an example of what are describing
Here's something I just threw together using a timer, custom painter and provider. I also ended up creating my own spring algorithm for the interactive repulsion and attraction between nodes. I think this is along the lines of what DeepStyles is talking about. It's also a little smoother than what is shown in the GIF. I recommend checking out the Java library Graph Stream for inspiration (https://graphstream-project.org/). I don't think it has been updated in a while but it would be awesome if that level of functionality existed in Flutter.
looks cool with animations...
Yes looks very good, I am not that good with animations though, if you can share the code @roberteverman or maybe look into mine, to give a suggestion that would be great.
lol github glitchy for me, anyway can we able to add and delete nodes dynamically(I saw nodes are pre-added in init method.
Yes we can add and remove notes dynamically. Have a look at the examples.
Yes looks very good, I am not that good with animations though, if you can share the code @roberteverman or maybe look into mine, to give a suggestion that would be great.
Absolutely! I'm a bit of a novice so I'll clean up my code, make it more readable and upload it by this weekend. I used the Graph, node and edge classes from your library but instead of the graphview I used my own positioned widgets inside of a stack and updated the positions dynamically based on gesture controllers on the nodes. There's probably a much better way to do it. For the animations, I just used a timer and stepped through the attraction / repulsion calculations updating the nodes every hundred milliseconds or so. The edges were done the same way but drawn with a custom painter. I set it up so I can stop and start the timer / animations using a boolean attached to the play button. The reset button just randomizes the starting coordinates for each node. I'm sure you can probably find a better way that uses less memory but it at least works well with small graphs.
Yes looks very good, I am not that good with animations though, if you can share the code @roberteverman or maybe look into mine, to give a suggestion that would be great.
Sorry for the delayed response. I've uploaded a (somewhat) cleaner version of my code in the example above here:
https://github.com/roberteverman/animated_graphview
Feel free to try it out here:
https://roberteverman.github.io/animated_graphview/#landing_screen
The play button in the top corner starts and stops the animations so you can drag the nodes individually. The refresh button randomizes the positions of the nodes. It's very basic and like I said there's probably at least a million ways of doing it better. Hopefully this gives you a couple of ideas for adding a draggable feature!
I'm waiting for this feature (including arrow following around and arrow change)
The draggable feature has been added now for directed graphs Have a look
@DeepStyles can you explain a bit more? what is the use case and what do you actually want.