Repository: flutter
Issue: Non-breaking space character isn't honored when using `WidgetSpan`s
Labels: framework,has reproducible steps,P2,team-framework,triaged-framework,found in release: 3.22

### Steps to reproduce

Use the example code to progressively constrain the available space for the text until there's not enough room to fit the icon image on the same line as the text before it.

Flutter version:

```
Flutter 3.19.6 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 54e66469a9 (4 weeks ago) • 2024-04-17 13:08:03 -0700
Engine • revision c4cd48e186
Tools • Dart 3.3.4 • DevTools 2.31.1
```

### Expected results

The text splits such that the word before the icon image moves to the next line, along with the icon image.

### Actual results

Only the icon image moves to the next line.

### Code sample

<details open><summary>Code sample</summary>

```dart
// ignore_for_file: missing_provider_scope
import 'package:flutter/material.dart';

void main() {
  runApp(
    const MaterialApp(
      home: _IconWrapDemo(),
    ),
  );
}

class _IconWrapDemo extends StatefulWidget {
  const _IconWrapDemo();

  @override
  State<_IconWrapDemo> createState() => _IconWrapDemoState();
}

class _IconWrapDemoState extends State<_IconWrapDemo> {
  int _bottomNavIndex = 0;
  double _constrainingPadding = 0;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: _buildContent(),
      bottomNavigationBar: _buildBottomNavBar(),
    );
  }

  Widget _buildContent() {
    return Column(
      children: [
        Expanded(
          child: Padding(
            padding: EdgeInsets.symmetric(horizontal: _constrainingPadding),
            child: Container(
              width: double.infinity,
              height: double.infinity,
              color: const Color(0xFFEEEEEE),
              child: Center(
                child: _bottomNavIndex == _iconMode //
                    ? _buildTextWithIcon()
                    : _buildTextWithEmoji(),
              ),
            ),
          ),
        ),
        Slider(
          value: _constrainingPadding,
          min: 0,
          max: 100,
          onChanged: (newValue) {
            setState(() {
              _constrainingPadding = newValue;
            });
          },
        ),
        const SizedBox(height: 48),
      ],
    );
  }

  Widget _buildTextWithIcon() {
    return const Text.rich(
      TextSpan(
        text: "Hello, world. This is long text that wraps.\u{00A0}",
        style: TextStyle(
          fontSize: 24,
        ),
        children: [
          WidgetSpan(
            child: Icon(Icons.image),
          ),
        ],
      ),
    );
  }

  Widget _buildTextWithEmoji() {
    return const Text(
      "Hello, world. This is long text that wraps.\u{00A0}🫠",
      style: TextStyle(
        fontSize: 24,
      ),
    );
  }

  Widget _buildBottomNavBar() {
    return BottomNavigationBar(
      currentIndex: _bottomNavIndex,
      onTap: (newIndex) => setState(() {
        _bottomNavIndex = newIndex;
      }),
      items: const [
        BottomNavigationBarItem(
          icon: Icon(Icons.image),
          label: "Icon",
        ),
        BottomNavigationBarItem(
          icon: Icon(Icons.text_fields),
          label: "Emoji",
        ),
      ],
    );
  }
}

int _iconMode = 0;
int _textMode = 1;

```

</details>


### Screenshots or Video

<details open>
<summary>Screenshots / Video demonstration</summary>

This video demonstrates the correct behavior of a non-breaking space with an emoji in the text, as compared to the broken behavior of a widget span that displays an icon image, which breaks the text at the wrong plae.


https://github.com/flutter/flutter/assets/7259036/d44246dc-41c4-4c78-935e-4671f5eccfc5



</details>


### Logs

<details open><summary>Logs</summary>

```console
[Paste your logs here]
```

</details>


### Flutter Doctor output

<details open><summary>Doctor output</summary>

```console
Flutter 3.19.6 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 54e66469a9 (4 weeks ago) • 2024-04-17 13:08:03 -0700
Engine • revision c4cd48e186
Tools • Dart 3.3.4 • DevTools 2.31.1
```

</details>