Repository: flutter
Issue: Wrap only the end of a long text following an inline code element in Markdown
Labels: package,team-ecosystem,has reproducible steps,P3,p: flutter_markdown,found in release: 3.7,found in release: 3.9,triaged-ecosystem

<!-- Thank you for using Flutter!

     If you are looking for support, please check out our documentation
     or consider asking a question on Stack Overflow:
      * https://flutter.dev/
      * https://api.flutter.dev/
      * https://stackoverflow.com/questions/tagged/flutter?sort=frequent

     If you have found a bug or if our documentation doesn't have an answer
     to what you're looking for, then fill out the template below. Please read
     our guide to filing a bug first: https://flutter.dev/docs/resources/bug-reports
-->

## Description
When using the flutter_markdown package, I am encountering an issue where the entire text following an inline code element wraps to a new line, even when there is enough space to display part of the text on the same line. I would like the text to wrap only when there is not enough space to display the entire row, and in such cases, only the words at the end of the text should wrap, not the entire text. This happens when using a custom MarkdownElementBuilder for the 'code' element.

## Steps to Reproduce

1. Create a new Flutter project and add `flutter_markdown: ^0.6.14` and `markdown: ^7.0.1` to the dependencies.
2. Replace the main.dart file with the following code.

**Expected results:** When there is not enough space to display the entire row of text, only the words at the end of the text following the inline code element should wrap to a new line.

**Actual results:** The entire text following the inline code element wraps to a new line, even though there is enough space to display part of the text on the same line.

<details>
<summary>Code sample</summary>

```dart
import 'package:flutter/material.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:markdown/markdown.dart' as md;

const text =
    "`awesomeYellowVariable` Lorem ipsum dolor sit amet, consectetur adipiscing elit.";

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      home: Scaffold(body: MyHomePage()),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key}) : super(key: key);

  @override
  MyHomePageState createState() => MyHomePageState();
}

class MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Markdown(
      data: text,
      builders: {
        'code': MarkdownCodeBuilder(),
      },
    );
  }
}

class MarkdownCodeBuilder extends MarkdownElementBuilder {
  @override
  Widget? visitElementAfter(md.Element element, TextStyle? preferredStyle) {
    final String textContent = element.textContent;
    final bool isCodeBlock = textContent.contains('\n');
    if (isCodeBlock) {
      return null;
    }
    return _InlineCode(text: textContent);
  }
}

class _InlineCode extends StatelessWidget {
  final String text;
  const _InlineCode({required this.text});

  @override
  Widget build(BuildContext context) {
    return Container(
      padding: const EdgeInsets.all(2),
      decoration: const BoxDecoration(
        color: Colors.yellow,
      ),
      child: Text(text),
    );
  }
}
```

</details>

<details>
  <summary>Logs</summary>

```
Launching lib/main.dart on macOS in debug mode...
main.dart:1
Connecting to VM Service at ws://127.0.0.1:64601/sc2j83ZEtTU=/ws
```

<!--
     Run `flutter analyze` and attach any output of that command below.
     If there are any analysis errors, try resolving them before filing this issue.
-->

```
➜  markdown_test flutter analyze
Analyzing markdown_test...                                              
No issues found! (ran in 1.2s)
```


```
➜  markdown_test flutter doctor -v
[✓] Flutter (Channel stable, 3.7.3, on macOS 12.6 21G115 darwin-x64, locale ru-RU)
    • Flutter version 3.7.3 on channel stable at /Users/dmitrijrepin/sdk/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 9944297138 (6 weeks ago), 2023-02-08 15:46:04 -0800
    • Engine revision 248290d6d5
    • Dart version 2.19.2
    • DevTools version 2.20.1

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0-rc2)
    • Android SDK at /Users/dmitrijrepin/Library/Android/sdk
    • Platform android-31, build-tools 31.0.0-rc2
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14C18
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2020.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • 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.10+0-b96-7281165)

[✓] IntelliJ IDEA Community Edition (version 2022.3)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • 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

[✓] VS Code (version 1.76.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.60.0

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-x64     • macOS 12.6 21G115 darwin-x64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 111.0.5563.64

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!
```

</details>

Screenshots:
<img width="491" alt="Снимок экрана 2023-03-22 в 11 22 24" src="https://user-images.githubusercontent.com/17158960/226829947-e911fc35-d479-4332-af49-131177055f58.png">

<img width="603" alt="Снимок экрана 2023-03-22 в 11 22 43" src="https://user-images.githubusercontent.com/17158960/226829976-5bef7cb0-78aa-44cb-9ea8-444866a7057f.png">