Layout
dart
import 'package:vyuh_document/layout.dart';
// also re-exported by package:vyuh_document_editor/document_editor_rendering.dartLayout resolves a document revision into immutable geometry: pages, fragments, lines, carets and hit regions. Paint, hit testing, carets, PDF and print all read that one snapshot. Layout is pure Dart; text measurement comes in through a port the editor implements with Flutter.
Core contracts
| Type | Purpose |
|---|---|
ResolvedDocumentLayout | The immutable geometry of one content revision |
DocumentLayoutGeneration | A layout bound to a document snapshot; ownsCanonicalSnapshot(...), materializeCompleteDocument(...) (used by export) |
DocumentLayoutSession, ContinuousDocumentLayoutSession | Paged and pageless layout sessions |
DocumentMeasurementPort | The text measurement seam (the editor supplies FlutterDocumentMeasurementPort) |
ResolvedBlockLayoutAdapter, ResolvedBlockLayoutAdapterRegistry | How an element contributes its geometry |
Pages and fragments
| Type | Purpose |
|---|---|
ResolvedPageFragment, ResolvedBlockFragment, ResolvedContainerFragment | Placed content |
ResolvedPageRegionFragment, ResolvedPageRegionTemplate | Headers and footers per page |
ResolvedPageFootnoteBand, ResolvedPageEndnoteBand | Note areas |
ResolvedFragmentIndexCatalog | Fragment lookup by page (indexesForPage) |
ResolvedFloatingBlockGeometry | Floating objects |
Interaction geometry
| Type | Purpose |
|---|---|
ResolvedHitRegion, ResolvedPageHitIndex | Pointer hit testing |
ResolvedCaretBox, ResolvedCaretOccurrence, ResolvedCaretLineIndex | Carets and line navigation |
ResolvedPageTextIndex | Text positions on pages |
Generated graphics
ResolvedGeneratedGraphicScene, ResolvedGeneratedGraphicLayoutAdapter and ResolvedGeneratedGraphicPaintArtifact carry Mermaid, KaTeX and diagram scenes from their element packages to every painter.
Integration
Paragraph projections use the shaped line's source-text range to determine which line owns an inline atom, formatting mark or caret. Tight exact and atLeast line spacing can make neighboring glyph boxes overlap vertically; that overlap does not move content to another source line. Hard-break text units, including CRLF, retain their source ownership in both text directions. Formatting marks project this geometry without changing document content or the reading camera.
Continuous admission evaluates the effective paragraph style. An inactive DropCapType.none is allowed, including when inherited or overriding an active style; an effective active cap still requires physical layout. Other elements must qualify through their registered continuous adapters. See the editor surface guide.
layout_integration.dart exposes frozen geometry storage and the occurrence catalog to sibling packages.