force_graph 0.6.0
force_graph: ^0.6.0 copied to clipboard
Forge2D based force directed graph with multiple graph layout algorithms (MDS, Spring Embedder, Distance based) and realistic physics.
0.6.0 #
New Features #
- Dynamic node and edge management: Added
addNode()andaddEdge()methods onForceGraphControllerfor runtime graph manipulation, with optional auto-select on node creation. - Node search: Added
searchNodes()method to search nodes by title, ID, or custom data. - Node highlighting: Added
highlightNodes()andresetHighlights()to dim non-matching nodes and emphasize a subset. - Directed edges:
ForceGraphEdgeDatanow supportsdirectedflag for one-way edges, rendered with arrowheads. - Edge labels: Edges can now display optional text labels via
labelandlabelStyleproperties. - Custom edge painters: Added
EdgePaintertypedef andcustomPainteronForceGraphEdgeDatafor fully custom edge rendering. - Node label visibility control: Added
NodeLabelVisibilityenum (always,hoveredOrSelected,selectedOnly,never) andshowLabel/labelStyleper-node overrides. - Pinned nodes:
ForceGraphNodeDatanow supportspinnedproperty to fix node positions in the physics simulation. - Secondary tap (right-click) support: Added
onNodeSecondaryTapandonSecondaryTapcallbacks with tooltip builder for context menus on nodes and empty space. - Circular layout: New
CircularGraphBuilderarranges nodes in a circle or concentric rings. - Node data immutability helpers: Added
copyWith()anddeepCopy()to bothForceGraphNodeDataandForceGraphEdgeData. clear()method: AddedForceGraphController.clear()to reset the entire graph state.Vector2re-export: Re-exportedforge2d.Vector2for convenience.- Example app overhaul: Complete rewrite as
ForceGraphShowcaseAppwith Material 3 theming, dark mode, dataset switching, layout algorithm selection, search, settings dialog, multi-node inspector, and add-node dialog.
Improvements #
- Force-directed layout: Refactored
SpringEmbedderto use Fruchterman-Reingold algorithm with temperature-based cooling and displacement clamping for more stable layouts. - Disconnected node handling: Nodes without edges are now placed at random positions instead of being ignored.
- Auto
minDistance:ForceDirectedGraphBuildernow calculatesminDistancefrom node radii if not explicitly set. - Edge weight rendering: Edge stroke width now scales properly with zoom level using world-space coordinates.
- Hit detection tolerance: Node hit detection now uses zoom-aware tolerance for better accuracy at different zoom levels.
- Node linear damping: Default damping increased from
2.5to3.5for more stable simulations. - Listener safety: Callback lists are now copied before iteration to prevent concurrent modification errors.
- Graph builder type safety: Numeric map inputs are now cast via
num.toDouble()/num.toInt()instead of direct cast, preventing type errors.
Bug Fixes #
- Shift+click selection: Added Shift+click support for toggling individual nodes without clearing existing selection.
0.3.9 #
Remove unecessary null check in removeNode