Skip to content

Commit

Permalink
Merge pull request #115 from emmby/master
Browse files Browse the repository at this point in the history
Update GraphView.dart
  • Loading branch information
nabil6391 authored Jan 23, 2024
2 parents 76ddad3 + 52b8d8c commit 0cb314b
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions lib/GraphView.dart
Original file line number Diff line number Diff line change
Expand Up @@ -239,14 +239,11 @@ class _GraphViewAnimated extends StatefulWidget {
final Graph graph;
final Algorithm algorithm;
final Paint? paint;
final nodes = <Widget>[];
final NodeWidgetBuilder builder;
final stepMilis = 25;

_GraphViewAnimated(
{Key? key, required this.graph, required this.algorithm, this.paint, required NodeWidgetBuilder builder}) {
graph.nodes.forEach((node) {
nodes.add(node.data ?? builder(node));
});
{Key? key, required this.graph, required this.algorithm, this.paint, required this.builder}) {
}

@override
Expand Down Expand Up @@ -296,7 +293,7 @@ class _GraphViewAnimatedState extends State<_GraphViewAnimated> {
...List<Widget>.generate(graph.nodeCount(), (index) {
return Positioned(
child: GestureDetector(
child: widget.nodes[index],
child: graph.nodes[index].data ?? widget.builder(graph.nodes[index]),
onPanUpdate: (details) {
graph.getNodeAtPosition(index).position += details.delta;
update();
Expand Down

0 comments on commit 0cb314b

Please sign in to comment.