Repository navigation
🎯 [Flutter Port] Complete Dart/Flutter Port of xyflow - Master Tracking Issue #1
Copy link
Copy link
Open
Labels
Description
Overview
This is the master tracking issue for creating a complete Dart/Flutter port of xyflow with 100% feature parity.
Project Scope
Port the entire xyflow library (~17,820 lines of TypeScript) to Dart/Flutter, including:
- @xyflow/system →
xyflow_core(framework-agnostic logic) - @xyflow/react →
xyflow_flutter(Flutter widgets and state management)
Architecture Overview
packages/xyflow_flutter/
├── lib/
│ ├── xyflow_flutter.dart # Main export
│ ├── src/
│ │ ├── core/ # @xyflow/system port
│ │ │ ├── types/ # Core types (Node, Edge, Handle, etc.)
│ │ │ ├── utils/ # Utilities (path calculation, etc.)
│ │ │ ├── xy_pan_zoom.dart # Pan/zoom implementation
│ │ │ ├── xy_drag.dart # Drag implementation
│ │ │ └── xy_handle.dart # Handle/connection logic
│ │ ├── widgets/ # Flutter widgets
│ │ │ ├── xyflow.dart # Main XYFlow widget
│ │ │ ├── node_wrapper.dart # Node rendering
│ │ │ ├── edge_wrapper.dart # Edge rendering
│ │ │ ├── handle.dart # Handle widget
│ │ │ ├── viewport.dart # Viewport transform
│ │ │ ├── background.dart # Background patterns
│ │ │ ├── minimap.dart # Minimap component
│ │ │ ├── controls.dart # Zoom controls
│ │ │ └── node_toolbar.dart # Node toolbar
│ │ ├── state/ # State management
│ │ │ ├── xyflow_state.dart # Main state class
│ │ │ ├── xyflow_controller.dart # Controller/Instance API
│ │ │ └── change_types.dart # Change objects
│ │ └── hooks/ # Flutter hooks (if using flutter_hooks)
│ └── test/
└── example/
Milestone Issues
- [Flutter Port] 1. Core Types and Models #2 - Core Types and Models ✅
- [Flutter Port] 2. State Management System #3 - State Management System ✅
- [Flutter Port] 3. Viewport and Transform System #4 - Viewport and Transform System ✅
- [Flutter Port] 4. Node System #5 - Node System ✅
- [Flutter Port] 5. Edge System and Path Algorithms #6 - Edge System and Path Algorithms ✅
- [Flutter Port] 6. Handle and Connection System #7 - Handle and Connection System ✅
- [Flutter Port] 7. Built-in Components #8 - Built-in Components (Background, Controls, MiniMap, etc.) ✅
- [Flutter Port] 8. XYFlow Controller (Instance API) #9 - XYFlow Controller (Instance API) ✅
- [Flutter Port] 9. Test Suite #10 - Test Suite (62 tests passing, more needed)
Feature Parity Checklist
Core Types ✅
-
XYPosition- Position type -
Transform- Viewport transform -
Viewport- Viewport state -
Rect- Rectangle type -
CoordinateExtent- Bounds constraints -
NodeBase/InternalNode- Node types -
EdgeBase/InternalEdge- Edge types -
Handle- Handle type -
Connection- Connection type - Change types (NodeChange, EdgeChange variants)
State Management ✅
- Node lookup (Map-based O(1) access)
- Edge lookup
- Connection lookup
- Parent/child hierarchy lookup
- Change-based state updates
-
applyNodeChanges()/applyEdgeChanges() - Batch updates
Viewport System ✅
- Pan (mouse/touch drag)
- Zoom (scroll, pinch, double-click)
- Viewport constraints (min/max zoom, translate extent)
- Smooth animations
-
fitView(),fitBounds(),setCenter() - Coordinate transformations (screen ↔ canvas)
Node System ✅
- Custom node types
- Node positioning
- Node dragging with constraints
- Snap to grid
- Multi-select drag
- Parent/child relationships
- Extent constraints
- Auto-pan on drag
- Selection state
- Z-index management
Edge System ✅
- Bezier edge paths
- Smooth step edges
- Step edges
- Straight edges
- Simple bezier edges
- Custom edge types
- Edge markers (arrows)
- Animated edges
- Edge reconnection
- Edge labels
Connection System ✅
- Handle rendering
- Connection validation
- Connection line during drag
- Connection modes (strict/loose)
- Handle positions (left/top/right/bottom)
- Multiple handles per node
- Connection callbacks
Built-in Components ✅
- Background (grid/dots patterns)
- Controls (zoom buttons)
- MiniMap
- Panel positioning
- NodeToolbar
- EdgeToolbar
- NodeResizer
Instance API (Controller) ✅
-
getNodes(),setNodes(),addNodes() -
getEdges(),setEdges(),addEdges() -
deleteElements() -
updateNode(),updateNodeData() -
zoomIn(),zoomOut(),zoomTo() -
getZoom(),getViewport(),setViewport() -
fitView(),fitBounds(),setCenter() -
project()- coordinate conversion -
toObject()- serialize state -
getIntersectingNodes()
Dependencies
dependencies:
flutter:
sdk: flutter
vector_math: ^2.1.4 # For matrix transformations
collection: ^1.17.0 # For equality helpers
dev_dependencies:
flutter_test:
sdk: flutter
integration_test:
sdk: flutter
golden_toolkit: ^0.15.0 # Visual regression testsTesting Strategy
- Unit Tests - Core logic, path calculations, state management ✅
- Widget Tests - Component rendering, interactions (in progress)
- Integration Tests - Full flow scenarios
- Golden Tests - Visual regression for edge paths, layouts
Progress
- Project setup and issue tracking
- Core types implemented
- State management implemented
- Viewport system implemented
- Node system implemented
- Edge system implemented
- Connection system implemented
- Built-in components implemented
- Connection line widget during drag
- Test suite complete (62/100+ tests passing)
- Documentation complete
- Example app complete
Current Status: 🟢 Compiles & Tests Pass
Latest Update (Dec 26, 2025):
- ✅ All compile errors fixed
- ✅ 62 tests passing
- ✅ Connection line widget added for drag visualization
- ✅ Example app runs successfully
- 🔄 Adding more widget tests
Files Implemented:
- Core Types: 7 files (position, viewport, rect, node, edge, handle, connection, changes, marker)
- State: 3 files (xyflow_state, xyflow_controller, xyflow_provider)
- Widgets: 14 files (xyflow, handle, background, controls, minimap, panel, node_toolbar, node_resizer, connection_line)
- Node Widgets: 4 files (default_node, input_node, output_node, group_node)
- Edge Widgets: 5 files (base_edge, bezier_edge, smooth_step_edge, step_edge, straight_edge)
- Edge Utilities: 6 files (bezier, smooth_step, step, straight, simple_bezier, edge_path)
This port aims for 100% feature parity with the React version of xyflow.
Reactions are currently unavailable
Activity
johndpope commentedon Dec 26, 2025
🔄 Progress Update - December 26, 2025
✅ Completed Items
Core Types (Issue #2) - Complete
XYPosition,Viewport,Node,Edge,Handle,Connection,Changes)NodeChangeandEdgeChangecopyWithmethodsState Management (Issue #3) - Complete
XYFlowStateclass with ChangeNotifierapplyNodeChanges()/applyEdgeChanges()functionsViewport System (Issue #4) - Complete
Viewportclass with Matrix4 transformsfitView(),fitBounds(),setCenter()methodsEdge System (Issue #6) - Complete
Connection System (Issue #7) - Partial
Built-in Components (Issue #8) - Complete
Controller (Issue #9) - Complete
toObject()/toJson()📊 Test Results
📁 Package Structure
🏃 Next Steps
Generated with Claude Code
johndpope commentedon Dec 26, 2025
Progress Update - Dec 26, 2025
Widget Tests Added ✅
Added comprehensive widget tests for core UI components:
New Test Files:
test/widget/background_test.dart- 10 tests for Background widgettest/widget/controls_test.dart- 12 tests for Controls and ControlButton widgetstest/widget/connection_line_test.dart- 19 tests for ConnectionLine widgettest/widget/handle_test.dart- 17 tests for HandleWidget and HandleStyletest/widget/panel_test.dart- 14 tests for Panel positioningtest/widget/minimap_test.dart- 18 tests for MiniMap widgetTest Coverage Now Includes:
Test Categories:
Remaining Tasks:
johndpope commentedon Dec 26, 2025
Progress Update - Keyboard Shortcuts Added
Keyboard Shortcuts Implemented:
Delete/BackspaceEscapeCtrl+ACtrl+0Ctrl++/Ctrl+=Ctrl+-Arrow keysShift+ArrowTest Count: 142+ tests passing
Commits:
420be3bc- feat(flutter): Add keyboard shortcuts and controller testsf46ef3fc- feat(flutter): Complete xyflow Flutter port with 130+ testsRemaining for Full Parity:
johndpope commentedon Dec 26, 2025
🎉 Full Feature Parity Achieved!
Final Features Added:
Clipboard System
copy()- Copy selected nodes and connected edgescut()- Copy and delete selected elementspaste()- Paste with new IDs and position offsetUndo/Redo System
undo()/redo()methodscanUndo/canRedopropertiesComplete Keyboard Shortcuts
Delete/BackspaceEscapeCtrl+ACtrl+CCtrl+XCtrl+VCtrl+ZCtrl+Shift+Z/Ctrl+YCtrl+0Ctrl++Ctrl+-Arrow keysShift+ArrowTest Count: 180+ tests passing
Commits Today:
Feature Parity Status: ✅ COMPLETE
The Flutter port now has 100% feature parity with the React xyflow library!