DirectGraph constructor

DirectGraph({
  1. Key? key,
  2. required List<NodeInput> list,
  3. required Size defaultCellSize,
  4. required EdgeInsets cellPadding,
  5. Clip clipBehavior = Clip.hardEdge,
  6. bool centered = false,
  7. NodeCellBuilder? nodeBuilder,
  8. double contactEdgesDistance = 5.0,
  9. MatrixOrientation orientation = MatrixOrientation.Horizontal,
  10. double tipAngle = math.pi * 0.1,
  11. double tipLength = 10.0,
  12. double maxScale = 2.5,
  13. double minScale = 0.25,
  14. EdgePathBuilder? pathBuilder,
  15. EdgePaintBuilder? paintBuilder,
  16. OverlayBuilder? overlayBuilder,
  17. EdgeLabels? edgeLabels,
  18. GestureBackgroundTapCallback? onCanvasTap,
  19. GestureEdgeTapDownCallback? onEdgeTapDown,
  20. GestureEdgeTapUpCallback? onEdgeTapUp,
  21. GestureEdgeLongPressStartCallback? onEdgeLongPressStart,
  22. GestureEdgeLongPressEndCallback? onEdgeLongPressEnd,
  23. GestureEdgeLongPressMoveUpdateCallback? onEdgeLongPressMoveUpdate,
  24. GestureEdgeForcePressStartCallback? onEdgeForcePressStart,
  25. GestureEdgeForcePressEndCallback? onEdgeForcePressEnd,
  26. GestureEdgeForcePressPeakCallback? onEdgeForcePressPeak,
  27. GestureEdgeForcePressUpdateCallback? onEdgeForcePressUpdate,
  28. GestureEdgeTapDownCallback? onEdgeSecondaryTapDown,
  29. GestureEdgeTapUpCallback? onEdgeSecondaryTapUp,
  30. GestureNodeTapDownCallback? onNodeTapDown,
  31. GestureNodeTapUpCallback? onNodeTapUp,
  32. GestureNodeLongPressStartCallback? onNodeLongPressStart,
  33. GestureNodeLongPressEndCallback? onNodeLongPressEnd,
  34. GestureNodeLongPressMoveUpdateCallback? onNodeLongPressMoveUpdate,
  35. GestureNodeForcePressStartCallback? onNodeForcePressStart,
  36. GestureNodeForcePressEndCallback? onNodeForcePressEnd,
  37. GestureNodeForcePressPeakCallback? onNodeForcePressPeak,
  38. GestureNodeForcePressUpdateCallback? onNodeForcePressUpdate,
  39. GestureNodePanStartCallback? onNodePanStart,
  40. GestureNodePanUpdateCallback? onNodePanUpdate,
  41. GestureNodePanDownCallback? onNodePanDown,
  42. GestureNodeTapDownCallback? onNodeSecondaryTapDown,
  43. GestureNodeTapUpCallback? onNodeSecondaryTapUp,
})

Draw direct graph using list of NodeInput's as source.

Use defaultCellSize to provide default cell size for each node. You can always provide custom cell size for specific node using NodeInput.size parameter inside each of instances.

Use cellPadding to set padding between nodes. Note, that increasing cellPadding will increase edges length, which might be useful if you need more space to add overlays or labels.

tipLength is the length (in pixels) of each of the 2 lines making the arrow. Ignored if using custom pathBuilder is set.

tipAngle is the angle (in radians) between each of the 2 lines making the arrow and the curve at this point. Ignored if using custom pathBuilder is set. Defaults to math.pi * 0.1.

If clipBehavior clipBehavior of internal InteractiveViewer and Stack. Defaults to Clip.hardEdge.

transformationController is TransformationController instance for internal InteractiveViewer. Can be used to programmatically control graphs view.

contentWrapperBuilder builder function to add wrapper for internal InteractiveViewer content. Useful when you need to add internal padding or to center content using MediaQuery.

centered if set to true all node outcomes will be centered relatively to it's parent as much as it's possible in rectangular space. Defaults to false.

nodeBuilder builder function to customize node Widget.

contactEdgesDistance distance between backward and forward oriented edge on their contact. If set to 0.0 contact edges collide into one just like two backward or two forward oriented edges. Defaults to 5.0.

maxScale maxScale value for internal InteractiveViewer.maxScale. Defaults to 2.5.

minScale minScale value for internal InteractiveViewer.minScale. Defaults to 0.25.

pathBuilder is a Path provider function to draw custom shaped edges. If provided arrows wont be added. May be used to highlight particular relations.

paintBuilder is a Paint provider function to customize color, width and style of edges. May be used to highlight particular relations.

overlayBuilder builder function to create interactive overlays on top of graph. For instance, tooltips, hovers or node detail panels.

edgeLabels details to add text (or custom widget) labels to edges.

onCanvasTap any point on canvas tap handler. Useful to cancel actions related to other handlers. For instance, hide tooltip.

orientation draw graph with MatrixOrientation.Horizontal orientation or MatrixOrientation.Vertical. Defaults to MatrixOrientation.Horizontal.

onEdgeTapDown,onEdgeTapUp,onEdgeLongPressStart,onEdgeLongPressEnd, onEdgeLongPressMoveUpdate,onEdgeForcePressStart,onEdgeForcePressEnd, onEdgeForcePressPeak,onEdgeForcePressUpdate, onEdgeSecondaryTapDown,onEdgeSecondaryTapUp gesture events for edges interactions. See GestureDetector for details. No pan/drag events since it conflicts with InteractiveViewer's pan events.

onNodeTapDown,onNodeTapUp,onNodeLongPressStart, onNodeLongPressEnd,onNodeLongPressMoveUpdate,onNodeForcePressStart, onNodeForcePressEnd,onNodeForcePressPeak,onNodeForcePressUpdate, onNodePanStart,onNodePanUpdate,onNodePanDown, onNodeSecondaryTapDown,onNodeSecondaryTapUp gesture events for nodes. See GestureDetector for details.

Implementation

DirectGraph({
  super.key,
  required this.list,
  required this.defaultCellSize,
  required this.cellPadding,
  this.clipBehavior = Clip.hardEdge,
  this.centered = false,
  this.nodeBuilder,
  this.contactEdgesDistance = 5.0,
  this.orientation = MatrixOrientation.Horizontal,
  this.tipAngle = math.pi * 0.1,
  this.tipLength = 10.0,
  this.maxScale = 2.5,
  this.minScale = 0.25,
  this.pathBuilder,
  this.paintBuilder,
  this.overlayBuilder,
  this.edgeLabels,
  this.onCanvasTap,
  this.onEdgeTapDown,
  this.onEdgeTapUp,
  this.onEdgeLongPressStart,
  this.onEdgeLongPressEnd,
  this.onEdgeLongPressMoveUpdate,
  this.onEdgeForcePressStart,
  this.onEdgeForcePressEnd,
  this.onEdgeForcePressPeak,
  this.onEdgeForcePressUpdate,
  this.onEdgeSecondaryTapDown,
  this.onEdgeSecondaryTapUp,
  this.onNodeTapDown,
  this.onNodeTapUp,
  this.onNodeLongPressStart,
  this.onNodeLongPressEnd,
  this.onNodeLongPressMoveUpdate,
  this.onNodeForcePressStart,
  this.onNodeForcePressEnd,
  this.onNodeForcePressPeak,
  this.onNodeForcePressUpdate,
  this.onNodePanStart,
  this.onNodePanUpdate,
  this.onNodePanDown,
  this.onNodeSecondaryTapDown,
  this.onNodeSecondaryTapUp,
});