DiagramTextDefinition class abstract

The text filling a text slot: what it admits and how it edits and presents.

Every text slot, whether a shape's text part, a table's cells, a connector's labels or a standalone text element, is filled by exactly one definition. Core supplies PlainTextDefinition: runs and paragraph breaks. Extensions contribute richer text, such as the rich text extension's lists, headings and marks, by overriding the behaviour below: they own the paragraph and run attributes they admit and persist them with codec. Every default is the plain behaviour.

Implementers

Constructors

DiagramTextDefinition({int maxLines = 0})
const

Properties

codec → DiagramTextCodec?
Persists the paragraph and run attributes this text admits, or null when it admits none. Installing the text installs its codec.
no setter
hashCode → int
The hash code for this object.
no setterinherited
markers → DiagramTextMarkers?
List and checklist markers, or null when this text draws none.
no setter
maxLines → int
Typed lines (paragraphs) a slot holds. 1 is a single line, where Enter is blocked; N allows at most N paragraphs; 0 is unlimited. Soft wrapping does not count.
final
properties → List<DiagramProperty<Object?, Object?>>
Inspector properties for the features this text adds.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
storyVerbs → List<DiagramVerb>
Verbs over the whole story of an element holding this text, such as rich text marks and lists, which format a range of story offsets. An element offers them once, however many of its parts hold this text.
no setter
type → String
Registered type, which is also the type of a standalone text element.
no setter
verbs → List<DiagramVerb>
The verbs of one text part, bound to its slot: setText for every text. A shape qualifies them by slot, such as title.setText, when it has several text parts.
no setter

Methods

admits(TextParagraph paragraph) → bool
Whether paragraph is valid in this text. The engine checks maxLines.
afterRegionCleared(TextParagraph paragraph) → TextParagraph
Paragraph metadata after a deletion clears a whole text region.
applyInputShortcut(TextStory story, int blockIndex, int caretOffset) → DiagramTextInputShortcutResult?
Converts a typed paragraph prefix ending at caretOffset of the paragraph at blockIndex, or returns null when no input rule applies.
atRegionStart(TextParagraph paragraph) → TextParagraph
Paragraph metadata after Backspace at the start of a text region.
describe(TextParagraph paragraph) → String
Accessible description of paragraph.
handleKey(DiagramTextKey key, DiagramTextKeyContext context) → DiagramTextKeyResult?
Handles a key chord on this text, or returns null to leave it to other handlers.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
present(TextParagraph paragraph, double defaultFontSize) → TextParagraph
The paragraph as laid out, for example with a heading's size applied. Text, identity and slot must be preserved.
restoreInputShortcut(TextStory story, int blockIndex, String text) → TextStory
Reverses applyInputShortcut on the paragraph at blockIndex, restoring the typed text. Returns story when nothing is restored.
split(TextParagraph paragraph, int offset, {required bool typed}) → DiagramParagraphSplitPlan?
Paragraph metadata when Enter (typed) or a pasted newline splits paragraph at offset. Null splits it unchanged.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited