Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quoting text containing an image is not rendered correctly #13

Open
mitalapo opened this issue May 16, 2024 · 0 comments
Open

Quoting text containing an image is not rendered correctly #13

mitalapo opened this issue May 16, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@mitalapo
Copy link

When quoting a section with an embedded image, the image is shown just before the quoted section, instead of where it was initially.

As an example, the following bbcode:

Quoting text with an image:
[quote=Someone]Image should show below this line
[img]https://source.unsplash.com/random/100x100[/img]
Image should show above this line.[/quote]

rendered as follows:

image

The following worked around the issue for me:

class MyImgTag extends WrappedStyleTag {

  MyImgTag() : super("img");

  @override
  List<InlineSpan> wrap(
      FlutterRenderer renderer, bbob.Element element, List<InlineSpan> spans) {
    String url = element.children.first.textContent;

    return [
      WidgetSpan(
          child: Image.network(url, 
          errorBuilder: (context, error, stackTrace) {
              return Text("Error loading image ($url)\n$error");
          })),
    ];
  }
}
@mitalapo mitalapo changed the title Quoting a text containing an image is not rendered correctly Quoting text containing an image is not rendered correctly May 16, 2024
@MartenM MartenM added the bug Something isn't working label May 20, 2024
@MartenM MartenM self-assigned this May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants