findTextScaler static method

TextScaler findTextScaler([
  1. Finder? finder
])

Finds and returns the textScaler that's applied to the SuperText.

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

Implementation

static TextScaler findTextScaler([Finder? finder]) {
  final element = (finder ?? find.byType(SuperText)).evaluate().single as StatefulElement;
  final superText = element.widget as SuperText;

  final renderLayoutAwareRichText = find
      .descendant(
        of: find.byWidget(superText),
        matching: find.byType(LayoutAwareRichText),
      )
      .evaluate()
      .first
      .widget as LayoutAwareRichText;

  return renderLayoutAwareRichText.textScaler;
}