-
-
Notifications
You must be signed in to change notification settings - Fork 875
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
Add support for selectable text via SelectableText.rich #682
Add support for selectable text via SelectableText.rich #682
Conversation
If we were to add support for 'selectable html' I would most definitely do so as a separate widget, under its own name, and not as a named constructor to Also, are we sure a widget that can have selectable text but only cover basic text use-cases is enough to satisfy any of our users? Is it enough to warrant this feature right now, kwoing we also have to then maintain and support it? |
My thinking is that it may not be enough but it's at least something. That flutter issue has been open for 2 years and there hasn't been any traction on it, so there's no telling when it will be fixed and thus allow full support with selectable content. Plus, the issue on this repo has the most upvotes and is the oldest feature request. I do see the flip side though, where it's another thing to maintain that isn't as feature-rich and might bring about a slew of its own issues. I'll leave the decision up to you, if you think this is warranted then I can fix it up a bit to make it merge-ready or we can close this. |
Hi, I coincidentally started working on a branch of my language learning application just a few hours ago to allow it to be used as an EPUB reader using the When I got it working, I found out the text could not be selected and it really got me down until I looked at the pull requests and found this one and got up to speed. I can select the text now! I am absolutely interested in this feature and will put it to good use, thank you for your work. |
I am waiting for this issue. Please fix it. A separate API is also fine. There is no selectable HTML widget in flutter. There is only one markdown widget but it has so many issues wherein * and _ gets dumped inadvertenly as the conversion from HTML to Markdown can have some bad after effects. We have an existing android app which gives this functionality so to disable it will also be uncool in a newer version due to this flutter issue. |
…into feature/selectable-text � Conflicts: � lib/flutter_html.dart
…into feature/selectable-text � Conflicts: � lib/html_parser.dart
Hurray!!! 🎉🎉🎉 All developer friend, who waited for this for a long time, we can import from master:
and, use this like:
THANK YOU SUPPORTERS OF THIS LIBRARY< WE LOVE YOU!!! |
Title.
Fixes #169.
Builds off work done in #679.
There are a few caveats due to Flutter #38474:
No support for
customRender
,customImageRender
,onImageError
,onImageTap
,onMathError
, andnavigationDelegateForIframe
. (Support forcustomRender
may be added in the future - once the updated customRender changes are merged because then we can supportCustomRender(textSpan: ...)
or something similar).You cannot whitelist tags, you must use
blacklistedElements
to remove any tags that shouldn't be rendered. This is to make sure unsupported tags are not accidentally whitelisted, causing errors in the widget code.The list of tags that can be rendered is significantly reduced. Key omissions include no support for images/video/audio, table, and ul/ol because they all require widgets and
WidgetSpan
s.Styling support is significantly reduced. Only text-related styling works (e.g. bold or italic), while container related styling (e.g. borders or padding/margin) do not work because we can't use the
ContainerSpan
class (it needs an enclosingWidgetSpan
).Due to the above, the margins between elements no longer appear. As a result, the HTML content will not have proper spacing between elements like
<h1>
. The default margin for<body>
is removed as well.I think this PR will satisfy the majority of simple use-cases, but proper support can't happen until that linked issue is resolved.