-
-
Notifications
You must be signed in to change notification settings - Fork 908
Support maxlines #596
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
Support maxlines #596
Conversation
We want to support this feature but it is not immediately intuitive how |
Agreed with @tneotia though I have to say supporting maxLines on a style (and for simplistic use-cases therefor supporting maxLines entirely) is quite unobtrusive and effective. I tend to approve the solution for these reasons. |
@erickok if you want to do something like this then what do you say about adding selectable text? Technically it has the same limitations as this feature - e.g. Flutter cannot handle selectable image/audio/video, tables, etc. |
Selectable text is also desirable. Both are the proposed solution in the pr is good for me, as it doesn't claim to limit the output to some number of lines, but directly as text style. |
I haven't tested this yet, which is the only reason I didn't yet merge. |
lib/style.dart
Outdated
/// | ||
/// | ||
/// | ||
int? maxLine; |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, this should be named maxLines
.
example/lib/main.dart
Outdated
Html( | ||
data: htmlDataLines, | ||
style: { | ||
'html': Style(maxLine: 1, textOverflow: TextOverflow.ellipsis), | ||
}, |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yes the example code here isn't the best to show of this feature. But I like the implementation itself. @nguyenxdat could you follow @tneotia 's suggestion and update the example app?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please reduce the changes in the example app and rename maxLine
to maxLines
and we will merge this PR. Thanks agian for the contribution.
example/lib/main.dart
Outdated
body: SingleChildScrollView( | ||
child: Html( | ||
data: htmlData, | ||
style: { | ||
"table": Style( | ||
backgroundColor: Color.fromARGB(0x50, 0xee, 0xee, 0xee), | ||
), | ||
"tr": Style( | ||
border: Border(bottom: BorderSide(color: Colors.grey)), | ||
), | ||
"th": Style( | ||
padding: EdgeInsets.all(6), | ||
backgroundColor: Colors.grey, | ||
child: Column( | ||
children: [ | ||
Html( |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks so much for this PR. @erickok this should be ready to go now.
No description provided.