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

Wrapping issue on long lines #17

Closed
Sub6Resources opened this issue Aug 31, 2018 · 18 comments
Closed

Wrapping issue on long lines #17

Sub6Resources opened this issue Aug 31, 2018 · 18 comments
Labels
bug Something isn't working high-priority
Milestone

Comments

@Sub6Resources
Copy link
Owner

Reported in #9 by @chusmf:

It happens when the sentence occupies more than 1 line in the space.

In the next example, the two first p tags are ok, the third one breaks in two lines

Html(
       data: """     
       <div>       
         <p>You <b>cannot </b> install a nonexistent product!</p>
         <p>You <b>cannot install </b>  a nonexistent product!</p>
         <p>You <b>cannot install </b> a nonexistent product from that shop!</p>          
       </div>
       """,  
       padding: EdgeInsets.all(8.0),
       backgroundColor: Colors.lightGreen);
@Kapranov98
Copy link

Maybe to use RichText to display text?

@Sub6Resources
Copy link
Owner Author

Sub6Resources commented Nov 3, 2018

RichText is what we were using before we switched to Wrap to display nodes, but because RichText does not have children widgets, we cannot render a full tree using RichText (For example, an img tag would not render inside an a tag). The switch to Wrap resolved those more problematic issues, but now has this issue instead.

@kevinApplaud
Copy link

Hi any news about this issue?

@Sub6Resources
Copy link
Owner Author

@kevinApplaud Pull request #37 is a proposed solution to the issue.

@petekblaz
Copy link

Any news on this?

@Sub6Resources
Copy link
Owner Author

Sorry, I've been busy with finals. Will get to this soon!

@ianrothmann
Copy link

Hi there!

Any news on this issue?

@The-Redhat
Copy link
Contributor

Wouldn't it be better to use TextSpans in p elements instead of Text Widgets?

@Sub6Resources
Copy link
Owner Author

@The-Redhat see #17 (comment) above

@Sub6Resources
Copy link
Owner Author

@ianrothmann Sorry, I have other projects for both work and school taking up a lot of my time that have priority over this project. I promise I will get to this, but it may be a couple weeks still.

@The-Redhat
Copy link
Contributor

Ok thanks @Sub6Resources. I hope you can fix this bug as soon as possible!

@Sub6Resources
Copy link
Owner Author

Sub6Resources commented Feb 1, 2019

Pull request #37 has been merged and version 0.9.0 released. This provides a fix for the text wrapping issue by creating a parser that uses RichText. The fix for the wrapping issue works, but at the cost of the customRender callback and doesn't support a couple of elements that are normally supported.

To use the new RichText version of the parser, set useRichText to true in your Html widget:

Html(
    data: """
      <p>
        This is text that with the <u>old parser</u> would have wrapped strangely. However, using <code>useRichText</code> it works just fine!
      </p>
    """,
    useRichText: true,
)

This issue will be closed and a new issue opened in regards to the default parser still having the issue.

@bpastukh
Copy link

bpastukh commented Apr 15, 2020

any workaround? I need to use customRender (to render iframes), so can't use RichText

UPD. my workaround is to render all elements manually

@Sub6Resources
Copy link
Owner Author

@bgpastukh You can also use version 1.0.0-pre.1 which has built in support for iframe rendering and wraps lines correctly as well.

@amanokerim
Copy link

Pull request #37 has been merged and version 0.9.0 released. This provides a fix for the text wrapping issue by creating a parser that uses RichText. The fix for the wrapping issue works, but at the cost of the customRender callback and doesn't support a couple of elements that are normally supported.

To use the new RichText version of the parser, set useRichText to true in your Html widget:

Html(
    data: """
      <p>
        This is text that with the <u>old parser</u> would have wrapped strangely. However, using <code>useRichText</code> it works just fine!
      </p>
    """,
    useRichText: true,
)

This issue will be closed and a new issue opened in regards to the default parser still having the issue.

How can I fix this on version 1.1.1, while there is no parameter useRichText?

@erickok
Copy link
Collaborator

erickok commented Jan 12, 2021

Since 1.x there is only one parser/renderer. No need to choose. If you have an issue with long text, you may open a new issue.

@amanokerim
Copy link

Since 1.x there is only one parser/renderer. No need to choose. If you have an issue with long text, you may open a new issue.

I have a problem like in #388, I thought that this can help. Any suggestions?

@erickok
Copy link
Collaborator

erickok commented Jan 12, 2021

@amanokerim Please file a new issue, with a minimal example to reproduce the problem. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working high-priority
Projects
None yet
Development

No branches or pull requests

9 participants