build method

  1. @override
SemanticNode build(
  1. SceneNode node,
  2. List<SemanticNode> children
)
override

Implementation

@override
SemanticNode build(SceneNode node, List<SemanticNode> children) {
  // A tap-wrapper around rich content (keyboard-dismiss GestureDetector,
  // tappable card) must keep its subtree — absorbing it blinds the agent.
  if (_wrapsRichContent(children)) {
    return SemanticButton(glintId: node.glintId, children: children);
  }
  // Leaf button: absorb caption text into the label; keep Icon / Image as
  // children so the IconEnricher can populate them post-classify.
  final label = _captionIn(children) ?? _implicitLabels[node.baseLabel];
  final kept = _mediaIn(children);
  return SemanticButton(
    glintId: node.glintId,
    label: label,
    children: kept,
  );
}