You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
refactor(erd): decompose 2900-line ErdView into pure ErdLayoutEngine, ErdCanvas, ErdTableCard and ErdMinimap #1362
lib/features/erd/erd_view.dart is currently the largest file in the codebase at 2,895 lines.
It violates the Single Responsibility Principle by combining multiple major subsystems:
Algorithmic Graph Layout: Dagre/force-directed positioning, rank assignment, layer assignment, FK edge routing and collision resolution.
Table Node Rendering: Node cards, column rows, PK/FK badges, data type labels, table context menus.
Minimap & Navigation: Miniature viewport representation and viewport jumping.
Image Export: PNG/SVG rendering and file export flows.
This makes modifying ERD features risky and hinders testing graph layout algorithms in isolation without mounting heavy widget trees (related to Epic #1286 and Epic #1166).
Proposed Solution
Decompose erd_view.dart into dedicated single-responsibility modules:
lib/core/erd/erd_layout_engine.dart: Pure non-widget algorithmic node placement and edge routing class, 100% unit-testable.
lib/features/erd/widgets/erd_canvas.dart: Canvas gesture handling, zoom/pan transform matrix, and edge painter.
lib/features/erd/widgets/erd_table_card.dart & erd_column_row.dart: Table card rendering, selection states, and badges.
Closing as done for its main goals; the rest moved to #1690.
Done (#1393, #1394, #1472 and earlier): the layout engine, router and geometry are in core/erd and ErdLayoutEngine is unit-tested without Flutter; ErdTableCard, ErdRelationPainter, ErdExporter and the note, group, search, views and export widgets are separate files. erd_view.dart went from 2,895 to 1,705 lines and the 52 widget tests under test/features/erd pass.
Not done and not planned here: the < 300 lines target (what is left is the widget's state, see #1690 for the follow-up), and the minimap, which does not exist in the product.
Activity
Merge pull request #1393 from QueryaHub/issue/1362-decompose-erd-view
Merge pull request #1394 from QueryaHub/issue/1362-erd-note-and-canvas
refactor(erd): export flows move out of ErdView into ErdExporter (#1472)
ZhuchkaTriplesix commentedon Oct 17, 2026
Closing as done for its main goals; the rest moved to #1690.
Done (#1393, #1394, #1472 and earlier): the layout engine, router and geometry are in
core/erdandErdLayoutEngineis unit-tested without Flutter;ErdTableCard,ErdRelationPainter,ErdExporterand the note, group, search, views and export widgets are separate files.erd_view.dartwent from 2,895 to 1,705 lines and the 52 widget tests undertest/features/erdpass.Not done and not planned here: the
< 300 linestarget (what is left is the widget's state, see #1690 for the follow-up), and the minimap, which does not exist in the product.