withEffectiveTextStyleMatching method

WidgetSelector<Text> withEffectiveTextStyleMatching(
  1. MatchProp<TextStyle> match
)

A WidgetSelector for Text widgets that meet specified TextStyle conditions, as defined by a custom matcher function.

Example:

spot<Text>().withText('foo').withEffectiveTextStyleMatching(
  (style) {
    style.fontSize.isGreaterOrEqual(20);
    style.fontStyle.isNotNull();
    style.fontWeight.equals(FontWeight.bold);
  },
).existsOnce();

See also:

Implementation

WidgetSelector<Text> withEffectiveTextStyleMatching(
  MatchProp<TextStyle> match,
) {
  return withProp(
    elementSelector: (subject) => subject.context.nest<TextStyle>(
      () => ['with "textStyle"'],
      (Element element) => Extracted.value(_extractTextStyle(element)),
    ),
    match: match,
  );
}