dvStudioNodeTitle function

String dvStudioNodeTitle(
  1. DVPageNode node,
  2. DVPageDocument document
)

What a node is called in Layers and in the command palette: the page, a leaf's palette label, or a box's layout label, with its text when it has some, so two Text elements can be told apart.

Implementation

String dvStudioNodeTitle(DVPageNode node, DVPageDocument document) {
  final String label = _dvStudioNodeLabel(node, document);
  final Object? text = node.properties['text'];
  if (text is String && text.trim().isNotEmpty) {
    final String t = text.trim();
    return '$label "${t.length > 32 ? '${t.substring(0, 31)}…' : t}"';
  }
  return label;
}