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

maxLines parameter TextStyle is not working as intended. #29

Closed
sandeepcmsm opened this issue Oct 3, 2018 · 12 comments
Closed

maxLines parameter TextStyle is not working as intended. #29

sandeepcmsm opened this issue Oct 3, 2018 · 12 comments
Labels
enhancement New feature or request help wanted Extra attention is needed high-priority

Comments

@sandeepcmsm
Copy link

if i pass maxLines parameter in defaultTextStyle , It is being applied into paragraph tags in html elements not for the whole data we pass. Is there any workaround for this?

@Sub6Resources
Copy link
Owner

Are you trying to limit the whole html document to maxLines?

@sandeepcmsm
Copy link
Author

Yes. Is there better work around for this ?

@Sub6Resources
Copy link
Owner

Not really, the defaultTextStyle applies to each text node individually, so the entire html document is hard to limit. What do you want the html document to do if it exceeds maxLines?

@sandeepcmsm
Copy link
Author

my usecase to have ellipsis at the end after document exceeds maxLines.

@Sub6Resources
Copy link
Owner

Yes, I see how that could be useful. I'll look into adding that as a feature.

@PalaniArunagiri
Copy link

Hi @Sub6Resources,
Our mobile app data are coming from CMS so obviously, there will be basic HTML tags like p, superscript, subscript tags which has to display in Flutter Text widget. But, right now Flutter is not providing the option to do it. We are happy to use your library to solve this problem. Right now, the problem is we are not able to set max lines and ellipses. Can you help us to solve this problem?. Our most of the texts will have superscript and subscript tags.

Thank you!
Palani Arunagiri

@dariotrombello
Copy link

Same here

@Sub6Resources Sub6Resources added help wanted Extra attention is needed high-priority and removed low-priority labels Mar 1, 2019
@Sub6Resources
Copy link
Owner

@PalaniArunagiri and @dariotrombello I'm currently in school full time and working part time as well so I don't have much time to work on this. Unfortunately, the widget doesn't have any sort of concept of the number of lines at the moment, so this isn't an easy fix. I've increased the priority of this feature request and added a "help wanted" label to attract attention to this issue for potential collaborators. If anybody has more time than I do and wants to take a shot at it, that would be awesome.

@krishnakumarcn
Copy link

Any updates on this feature?

@erickok
Copy link
Collaborator

erickok commented Feb 8, 2021

I am not sure if we can support max-lines in any meaningful way, really. For a simple single piece of text this seems intuitive, but what does max-lines mean in the context of html tables, image, summary/details, lists... Wouldn't you rather have a max height?

@tneotia
Copy link
Collaborator

tneotia commented May 3, 2021

#596 has been merged, this brings basic support for maxlines on text nodes. You can use the style parameter to set maxLines for your desired HTML selector, e.g.:

Html(
   data: '<p>This is a really very extremely loooooong text that is going to be limited to two lines and have ellipsis at the end of the second line. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>'
   style: {
      'p': Style(maxLines: 2, textOverflow: TextOverflow.ellipsis)
   }
)

@berhili098
Copy link

any news about the readmore feature with html widget

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed high-priority
Projects
None yet
Development

No branches or pull requests

8 participants