hasEffectiveTextStyleWhere method

WidgetMatcher<Text> hasEffectiveTextStyleWhere(
  1. MatchProp<TextStyle> match
)

A WidgetMatcher for Text widgets that performs specific assertions by applying a custom matcher function to TextStyle properties.

Example:

spot<Text>().withText('foo').existsOnce()
  .hasEffectiveTextStyleWhere(
            (style) => style
              ..fontSize.isGreaterOrEqual(14)
              ..letterSpacing.isNotNull()
              ..fontStyle.equals(FontStyle.italic),
          );

See also:

Implementation

WidgetMatcher<Text> hasEffectiveTextStyleWhere(MatchProp<TextStyle> match) {
  return hasProp(
    elementSelector: (subject) => subject.context.nest<TextStyle?>(
      () => ['has "textStyle"'],
      (Element element) => Extracted.value(_extractTextStyle(element)),
    ),
    match: match.hideNullability(),
  );
}