findParagraphStyle static method

TextStyle? findParagraphStyle(
  1. String nodeId, [
  2. Finder? superDocumentFinder
])

Finds and returns the TextStyle that's applied to the top-level of the TextSpan in the paragraph with the given nodeId.

By default, this method expects a single SuperReader in the widget tree and finds it byType. To specify one SuperReader among many, pass a superDocumentFinder.

Implementation

static TextStyle? findParagraphStyle(String nodeId, [Finder? superDocumentFinder]) {
  final documentLayout = _findDocumentLayout(superDocumentFinder);

  final textComponentState = documentLayout.getComponentByNodeId(nodeId)!;
  final superText = find
      .descendant(of: find.byWidget(textComponentState.widget), matching: find.byType(SuperText))
      .evaluate()
      .single
      .widget as SuperText;
  return superText.richText.style;
}