
This pull request addresses a critical issue identified in the `flutter_markdown` package, specifically relating to the handling of `WidgetSpan` elements within `Text.rich` elements when utilized inside `MarkdownElementBuilder`s. Prior to this fix, the inclusion of `WidgetSpan` instances within markdown content led to casting issues, disrupting the normal rendering flow of the markdown content. Key Changes: - Resolved casting problems associated with using `WidgetSpan` inside `Text.rich` elements by refining the type handling and span merging logic within the affected functions. - Thoroughly commented and cleaned up the code within the error-prone functions to enhance readability and maintainability, ensuring that future modifications can be made more easily. - Adjusted existing tests to align with the newly introduced span merging logic, which is now more efficient and produces more predictable outcomes. - Introduced new tests specifically designed to cover scenarios where `WidgetSpan` elements are included within markdown content, ensuring that this issue does not resurface in future updates. The adjustments made in this pull request ensure that developers utilizing the `flutter_markdown` package can now seamlessly incorporate `WidgetSpan` elements within their markdown content without encountering the previously observed casting issues. This fix not only improves the package's robustness but also expands its flexibility, allowing for richer text compositions within markdown. This pull request closes issue [#144383](https://github.com/flutter/flutter/issues/144383), effectively addressing the reported bug and enhancing the overall functionality of the `flutter_markdown` package. I'm welcoming feedback and suggestions for improvement. Fixed issues: * [#144383](https://github.com/flutter/flutter/issues/144383)
Flutter Packages
This repo is a companion repo to the main flutter repo. It contains the source code for Flutter's
first-party packages (i.e., packages developed by the core Flutter team).
Check the packages
directory to see all packages.
These packages are also available on pub.
Issues
Please file any issues, bugs, or feature requests in the main flutter repo. Issues pertaining to this repository are labeled "package".
Contributing
If you wish to contribute a new package to the Flutter ecosystem, please see the documentation for developing packages. You can store your package source code in any GitHub repository (the present repo is only intended for packages developed by the core Flutter team). Once your package is ready you can publish to the pub repository.
If you wish to contribute a change to any of the existing packages in this repo, please review our contribution guide, and send a pull request.
Packages
These are the packages hosted in this repository: