textFor method
The text filling slotId: its text part, the cells of the content
region in story that owns it, or plain text.
Implementation
DiagramTextDefinition textFor(String slotId, [TextStory? story]) {
for (final layer in expandedLayers) {
if (layer is ShapeTextLayerDefinition && layer.slotId == slotId) {
return layer.textType;
}
}
for (final content in story?.contents ?? const <TextStoryContent>[]) {
if (!content.editingSlotIds.contains(slotId)) continue;
for (final layer
in expandedLayers.whereType<ShapeContentLayerDefinition>()) {
if (layer.slotId == content.slotId &&
layer.contentType == content.contentType) {
return layer.textFor(content, slotId) ?? const PlainTextDefinition();
}
}
}
return const PlainTextDefinition();
}