spotText function
WidgetSelector<AnyText>
spotText(
- Pattern text, {
- List<
WidgetSelector< parents = const [],Widget> > - List<
WidgetSelector< children = const [],Widget> > - bool exact = false,
Finds text on the screen
spotText compares text using 'contains'. For more control over the
comparison, use spotTextWhere or set exact
to true
.
This method combines finding of Text, EditableText and SelectableText widgets. Ultimately, all widgets show text as RichText widget.
For assertions against specific text widgets and their properties, use the normal spot method and set the text widget type as generic type argument.
final welcome = spot<Text>().whereText((it) => it.equals("Hello"));
welcome.first().snapshot().hasMaxLines(1).hasTextAlign(TextAlign.center);
Implementation
@useResult
WidgetSelector<AnyText> spotText(
Pattern text, {
List<WidgetSelector> parents = const [],
List<WidgetSelector> children = const [],
bool exact = false,
}) {
return _global.spotText(
text,
parents: parents,
children: children,
exact: exact,
);
}