For example, I may have one RichText
in current widget tree, that looks like
RichText(
text: TextSpan(
text: 'Hello ',
style: DefaultTextStyle.of(context).style,
children: <TextSpan>[
TextSpan(text: 'bold', style: TextStyle(fontWeight: FontWeight.bold)),
TextSpan(text: ' world!'),
],
),
)
I try to use find.text('Hello bold world!')
but it doesn't work because it's not a Text.
expect(find.byWidgetPredicate((Widget widget) => widget is RichText && widget.text.toPlainText() == 'Hello bold world'), findsOneWidget);
– Avaricious