You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[flutter_markdown] Fix WidgetSpan Support in MarkdownElementBuilder (flutter#6225)
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 [flutter#144383](flutter#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:
* [flutter#144383](flutter#144383)
0 commit comments