Sub6Resources / flutter_html

A Flutter widget for rendering static html as Flutter widgets (Will render over 80 different html tags!)
https://pub.dev/packages/flutter_html
MIT License
1.76k stars 814 forks source link

Use SelectableText - Selectable content #169

Closed franvera closed 3 years ago

franvera commented 4 years ago

Would it be possible to implement the https://api.flutter.dev/flutter/material/SelectableText-class.html#material.SelectableText.2 widget as a parent?

It appears the constructor SelectableText.rich can be useful for this.

Sub6Resources commented 4 years ago

That's definitely a possibility, though this will probably only be helpful for a small subset of users, so it would default to a normal RichText with some sort of boolean parameter that makes the text selectable.

I'll look into adding this soon.

franvera commented 4 years ago

@Sub6Resources I agree, a boolean parameter would be great 😁Thank you for all your work!

bekchan commented 4 years ago

Any news on this feature? I really need it.

gzlock commented 4 years ago

Yep, I need it too

GeertJohan commented 4 years ago

I can implement this. @Sub6Resources Can we have a quick brainstorm/discussion on the tech design? I'd like to know how you'd prefer this to be implemented, especially with the new styling approach. I'm on gitter.im or maybe you can suggest an outline in this thread?

qingant commented 4 years ago

Any news on this feature? I really need it.

Sub6Resources commented 4 years ago

Quick update on the SelectableHtml widget:

@GeertJohan and I have been discussing this feature. We discovered that SelectableText.rich() requires that all the elements passed into it be TextSpans. Unfortunately, flutter_html makes use of WidgetSpans in addition to the regular TextSpans. I'm working on opening an issue on the main Flutter repository to potentially resolve this, but in the meantime we're looking into allowing Html snippets that don't make use of WidgetSpans (i.e. basic inline styled elements without customRender) to be made selectable using the SelectableHtml.

tl;dr: This is difficult at the moment due to limitations in the Flutter SelectableText framework, so we're currently looking at building the SelectableHtml widget for only very simple Html snippets.

softmarshmallow commented 4 years ago

Looking forward to it!

sp213 commented 4 years ago

I'm looking forward to it too! Really appreciated for this excellent plugin! 💯

GeertJohan commented 4 years ago

I'm not yet implementing this feature because it will have almost no effect for me, I need links to work and found out that clickable elements don't work with SelectableText.rich().

See https://github.com/flutter/flutter/issues/43494

Once this has been resolved, I can properly work on a SelectableHtml that works for simle html.

nicholasgerard commented 4 years ago

@GeertJohan @Sub6Resources Looks like this is fixed on flutter/dev. I'm happy to help with the implementation/design if needed.

Sub6Resources commented 4 years ago

@nicholasgerard It looks like the issue was closed but I don't see any PRs that mention where the change was made. Do you see something I'm not?

nicholasgerard commented 4 years ago

@Sub6Resources Sorry I meant flutter/master, it hasn't landed on dev yet:

https://github.com/flutter/flutter/pull/54479

softmarshmallow commented 4 years ago

how is it going on? flutter now supports selectable text

Sub6Resources commented 4 years ago

This feature will take some time to roll to stable. There are also other blocking issues in the flutter framework right now that prevent most HTML from being made selectable and will slow down this feature considerably. Unfortunately it's not as trivial as switching out a RichText() for a SelectableText.rich()

RyanSusana commented 4 years ago

Can this be resolved with the new Flutter Stable?

lianfanghua commented 4 years ago

Any news? Is this feature implemented in v1.0.0?

sp213 commented 4 years ago

Still looking forward to it too!

ynsmtkl commented 4 years ago

Still waiting also for this

GeertJohan commented 4 years ago

Please be kind and use emoji's or watch this issue instead of posting "Please build this" etc. messages. Those kind of messages are only spamming the thread.

rodrigorafaeldamaceno commented 3 years ago

something news about this issue?

droplet-js commented 3 years ago

We can refer to zefyr

aleksandr-plujnik commented 3 years ago

another option: use flutter_markdown + html2md. works for me (html rich messages for chatting)

kubaprzetakiewicz commented 3 years ago

What's the status right now - is this being actively worked on or do you welcome PRs?

erickok commented 3 years ago

There is no active development in this. PRs are always welcome, especially if they are concise and backward compatible.

erickok commented 3 years ago

To be clear, this is blocked on a Flutter issue https://github.com/flutter/flutter/issues/38474

jhass commented 3 years ago

Thanks, that's some progress! However, should we open a new issue to track feature parity between Html and SelectableHtml?

erickok commented 3 years ago

Yes, they can be opened in separate issue. Though as mentioned above https://github.com/flutter/flutter/issues/38474 likely precludes us from fixing said issues.

dan1229 commented 2 years ago

Any update on this? Would love to use the SelectableHtml widget but it can't even display images