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

How to add multiple widgets at same line without breaking line like TextSpan? #53

Closed
mesuutt opened this issue Jan 31, 2019 · 5 comments
Labels
duplicate This issue or pull request already exists

Comments

@mesuutt
Copy link

mesuutt commented Jan 31, 2019

First of all thanks to contributors for creating this package. I love it.

I encouraged a problem and I don't know how to solve.
I want to add multiple widgets to same line without break line if not necessary.

I want to show this html shown as below:

aaaaaaaaaaaaaaaaaaaaa<span class="koyusiyah">(bar)</span>bbbbbbbbbbbbbbbbb bbbbbbbbbbb<span class="koyusiyah">(ccccccccccc cccc dddddddd eeeee)</span> ccc;

1548970594


    Widget html = new Html(
      data: """aaaaaaaaaaaaaaaaaaaaa<span class="koyusiyah">(bar)</span>bbbbbbbbbbbbbbbbb bbbbbbbbbbb<span class="koyusiyah">(ccccccccccc cccc dddddddd eeeee)</span> ccc;""",
      defaultTextStyle: TextStyle(color: Color.fromRGBO(134, 0, 0, 1)),
      renderNewlines: false,

      customRender: (node, children) {
        if(node is dom.Element) {
          switch(node.localName) {
            case "span": {
              String className = node.attributes['class'];
              if (["koyusiyah", "normalsiyah"].contains(className)) {
                return RichText(
                  text: TextSpan(
                    text: node.text, style: TextStyle(color: Colors.black),
                    //children: children,
                  ),
                );
              }
            }
            break;

          }
        }
      },
    );

This code produce following output.

sil1

I think the code producing this output because customRenderer returning Widget instead of TextSpan. If I can put widgets side by side without breaking if widget not fit to same line like TextSpan this problem will be solved.

Thanks for helps.

@Sub6Resources
Copy link
Owner

Thank you. This issue has already been reported in #17 and I'm currently looking into some solutions. Follow that issue to keep track of progress.

@SammyO
Copy link

SammyO commented Jul 8, 2019

I'm experiencing the same issue. Is this fixed or still pending?

@Sub6Resources
Copy link
Owner

This is still an issue if useRichText is explicitly set to false. Check out #17 for more information.

@SammyO
Copy link

SammyO commented Jul 9, 2019

@Sub6Resources thank you for your quick reply. I've set useRichText to true, but it seems my customRender isn't called at all anymore. Any idea why this could be, or is this is being discussed somewhere else already where I can follow it?

@SammyO
Copy link

SammyO commented Jul 9, 2019

I believe I'm experiencing the same issue as described in #115 , which I see is on planned to be fixed with version 1.0.0.

So please disregard these comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

3 participants