Repository navigation
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Follow-up to #1362, which took erd_view.dart from 2,895 to 1,705 lines (layout engine, router and geometry in core/erd, ErdTableCard, ErdRelationPainter, ErdExporter, note and group widgets, search / views / export menus). What is left is one class, _ErdViewState: about 1,580 lines, ~135 members, ~31 state fields, and a 305-line build.
What is still in _ErdViewState
- Canvas: scale, pan, fit (
_setScale,_zoomBy,_fit), tap and hover (_tapCanvas,_hoverCanvas), theInteractiveViewerinbuild. - Selection and focus:
_selectTable,_clearSelection,_syncFocus,_cardFocusFor, search picking. - Saved views:
_applyState,_showState,_switchView,_newView,_renameView,_deleteView,_scheduleSave,_saveNow,_current. - Groups and notes: create, edit, gather, drag, resize.
- Card dragging and re-routing:
_dragStart/_dragMove/_dragEnd,_scheduleRoutes.
Change
ErdViewController(aChangeNotifier, no widget imports) owns selection, focus, search state, saved views, groups and notes. The pure operations that already live incore/erd(erd_group_ops,erd_note_ops,erd_saved_layout) stay there and are called from it.ErdCanvaswidget owns theInteractiveViewer, scale / fit / tap / hover and the drag of cards._ErdViewStatecomposes the two with the toolbar, menus and dialogs.
Acceptance
-
erd_view.dartis at most ~900 lines, andbuildis split into parts of a readable size. - Selection, focus, saved-view switching, groups and notes are covered by unit tests that need no
WidgetTester. - The existing 52 widget tests under
test/features/erdpass unchanged (no loosened expectations). - No change in behaviour or look; hover and drag rebuild only what they rebuilt before (perf(erd): hover rebuilds and repaints the whole canvas; no viewport culling; first layout on the UI thread #1169, perf(erd): router rebuilds the obstacle grid and re-routes every edge on each drag move #1168).
Not in scope
- The minimap from refactor(erd): decompose 2900-line ErdView into pure ErdLayoutEngine, ErdCanvas, ErdTableCard and ErdMinimap #1362: there is no minimap in the product.
- The "under 300 lines" target of refactor(erd): decompose 2900-line ErdView into pure ErdLayoutEngine, ErdCanvas, ErdTableCard and ErdMinimap #1362: it no longer describes how the view is built.
Notes
Medium risk (31 fields shared by most handlers); do it as a few small PRs: controller first, canvas second. Low priority unless ERD work is planned.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request
Activity
refactor(erd): ErdViewController, toolbar, group menu and card cache …
refactor(erd): ErdViewport and ErdCanvas out of _ErdViewState, saved-…