Skip to content

refactor(erd): decompose ErdView (part of #1362) - #1393

Merged
ZhuchkaTriplesix merged 8 commits into
devfrom
issue/1362-decompose-erd-view
Oct 10, 2026
Merged

ZhuchkaTriplesix merged 8 commits into
devfrom
issue/1362-decompose-erd-view

Conversation

@ZhuchkaTriplesix

@ZhuchkaTriplesix ZhuchkaTriplesix commented Oct 10, 2026 •

Copy link
Copy Markdown
Member

Part of #1362 (first step; the issue stays open until erd_view.dart is a thin coordinator).

What this PR does

  • Extracts ErdTableCard (+ ErdCardFocus, erdCardBuilds) to lib/features/erd/widgets/erd_table_card.dart.
  • Extracts ErdRelationPainter and roundedPath to lib/features/erd/widgets/erd_relation_painter.dart.
  • Moves the pure, widget-free erd_layout, erd_router, erd_geometry from features/erd to core/erd.
  • Adds ErdLayoutEngine (lib/core/erd/erd_layout_engine.dart): visible-schema, saved-position merge, neighbour/junction maps, focus and search, previously private methods of the view state.
  • Adds test/core/erd/erd_layout_engine_test.dart: pure unit tests, no widget tester.
  • erd_view.dart re-exports erdCardBuilds and roundedPath so existing importers keep working. No behaviour change intended.

Not done yet (stays on #1362)

  • erd_view.dart is still ~2400 lines (acceptance: < 300).
  • Canvas gesture/zoom, ErdViewController (selection/focus/search), and export flows are still in the view state.
  • The issue mentions a minimap; there is none in erd_view.dart today, so there is nothing to extract.

Not run locally; CI is the check.

Move the table card widget and the relation painter (with roundedPath)
into lib/features/erd/widgets. erd_view.dart re-exports erdCardBuilds and
roundedPath so existing importers keep working. No behaviour change.
…youtEngine

- move erd_layout, erd_router and erd_geometry (pure Dart, no widgets) from
  features/erd to core/erd and update imports
- add ErdLayoutEngine with the pure visible-schema, saved-position merge,
  neighbour/junction map, focus and search logic that lived in the view
  state, so it can be unit tested without a widget tree
@github-actions github-actions Bot added frontend Theme parser epic label: frontend ui User interface components and widgets P2 Medium priority / Parity & Refactoring labels Oct 10, 2026
- add super.key to ErdTableCard now that it is public
- drop imports already provided by shadcn_flutter and flutter_test
…widgets

- ErdExportData: SVG header fills, notes, group frames and theme colours as
  functions of their arguments instead of view state
- ErdViewsMenu, ErdSearchPanel, ErdEdgeTipLabel and ErdGroupFrame widgets
  under features/erd/widgets; the view state only passes data and callbacks
- ErdExportMenu and the public ErdExportAction enum
- ErdTableMenu.items for a card's context menu
- ErdStatusBody for the error, all-hidden, no-tables and no-relations bodies
Grouping, ungrouping, numbering and adding tables are now pure list
functions with unit tests; the view state only applies the result.
@ZhuchkaTriplesix
ZhuchkaTriplesix marked this pull request as ready for review October 10, 2026 18:54
@ZhuchkaTriplesix
ZhuchkaTriplesix merged commit 242282c into dev Oct 10, 2026
15 checks passed
@ZhuchkaTriplesix
ZhuchkaTriplesix deleted the issue/1362-decompose-erd-view branch October 11, 2026 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend Theme parser epic label: frontend P2 Medium priority / Parity & Refactoring ui User interface components and widgets

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant