Repository: flutter
Issue: Unable to find text when `TextSpan` and `WidgetSpan` placed in `RichText`.
Labels: a: tests,framework,a: typography,has reproducible steps,P2,found in release: 3.7,found in release: 3.10,team-framework,triaged-framework

### Is there an existing issue for this?

- [X] I have searched the [existing issues](https://github.com/flutter/flutter/issues)
- [X] I have read the [guide to filing a bug](https://flutter.dev/docs/resources/bug-reports)

### Steps to reproduce

Unnable to find text when `TextSpan` and `WidgetSpan` placed in `RichText`.

### Expected results

Test passed

### Actual results

Test failed

### Code sample

<details><summary>Code sample</summary>

```dart

import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';

void main() {
  testWidgets('Find text near a WidgetSpan', (WidgetTester tester) async {
    await tester.pumpWidget(MaterialApp(
      home: Scaffold(
        body: RichText(
          text: const TextSpan(
            children: [
              TextSpan(text: "some text"),
              WidgetSpan(child: SizedBox()),
            ]
          ),
        ),
      ),
    ));

    // expect(find.text('some text￼', findRichText: true), findsOneWidget); // passed

    expect(find.text('some text', findRichText: true), findsOneWidget); // failed
  });
}


```

</details>


### Screenshots or Video

_No response_

### Logs

_No response_

### Flutter Doctor output

<details><summary>Doctor output</summary>

```console

[√] Flutter (Channel stable, 3.7.10, on Microsoft Windows [Version 10.0.22621.1555], locale ru-RU)
    • Flutter version 3.7.10 on channel stable at C:\Users\Andri\Documents\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 4b12645012 (10 days ago), 2023-04-03 17:46:48 -0700
    • Engine revision ec975089ac
    • Dart version 2.19.6
    • DevTools version 2.20.1

[!] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
    • Android SDK at C:\Users\Andri\AppData\Local\Android\sdk
    X cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    X Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.5.3)
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.5.33516.290
    • Windows 10 SDK version 10.0.22000.0

[√] Android Studio (version 2022.1)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-9505619)

[√] VS Code (version 1.77.1)
    • VS Code at C:\Users\Andri\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension can be installed from:
       https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[√] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.22621.1555]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 111.0.5563.147
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 111.0.1661.54

[√] HTTP Host Availability
    • All required HTTP hosts are available

```

</details>