withEffectiveTextStyleMatching method
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:
- withEffectiveTextStyle, for selecting Text widgets widgets that have a fixed TextStyle value.
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,
);
}