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

Feature request: Create graph based on data entries and provide builder argument #11

Closed
orestesgaolin opened this issue Oct 19, 2020 · 6 comments
Labels
enhancement New feature or request

Comments

@orestesgaolin
Copy link

Hi, thanks for building and maintaining such a great package.

I wonder if it would be possible to allow generating a graph based on purely data classes and not widgets.

Here's what I mean. Now nodes need to be created with widgets as their arguments:

final node = Node(
  MyWidget(
    data: data,
  ),
  key: Key(data.id),
);
graph.addNode(node);

What I would love to see is to be able to just provide some data or id:

final node = NodeData(
  id: data.id
);
graph.addNode(node);

And then when creating a GraphView I would be able to provide builder:

GraphView(
  graph: graph,
  algorithm: g.BuchheimWalkerAlgorithm(
    g.BuchheimWalkerConfiguration(),
    g.TreeEdgeRenderer(builder),
  builder: (data){
    // I can decide what widget should be shown here
    return MyWidget(data: data);
  }
),

This would simplify populating graph data and would abstract Flutter/material dependencies

@nabil6391
Copy link
Owner

@orestesgaolin its a good idea actually. But if someone wants to place a widget based on position or connections then it might be a bit of a problem. Any suggestions on that?

@nabil6391 nabil6391 added the enhancement New feature or request label Oct 20, 2020
@orestesgaolin
Copy link
Author

Hi there, I started to add this feature on my own. This will take some time to be runnable, but hopefully within few days I should be able to propose some change.

Do you mind if I change the code style a bit to be more aligned with Flutter libraries in general? E.g. file naming, objects instantiation etc.?

@nabil6391
Copy link
Owner

I am ok with the changes and welcome PRs, it would be better if you can create one to change the Code Style first. If thats possible

@nabil6391
Copy link
Owner

@orestesgaolin is there any time frame you can create the PR if possible

@nabil6391
Copy link
Owner

@orestesgaolin I am working on this feature atm, do you think the id should be a ValueKey or a dynamic ?

@nabil6391
Copy link
Owner

This has been implemented in version 0.7.0. Have a look

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

No branches or pull requests

2 participants