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.79k stars 860 forks source link

[Investigate] Remove SelectableText in favor of SelectionArea? #1137

Closed erickok closed 1 year ago

erickok commented 2 years ago

We should investigate if we can simplify our support for selectable text by removing the usage of SelectableText (which has limitations and behaviour differences) in favor of simply wrapping (even even just recommending) SelectableArea SelectionArea, introduced in Flutter 3.3.

Of course the text selection needs to be as least as good (in behaviour and features) as what we have right now. It could simplify our code though and remove the need to document limitations when using SelectableHtml.

Additional context https://api.flutter.dev/flutter/material/SelectionArea-class.html for the official doc.

erickok commented 2 years ago

A very quick try, wrapping the example app in SelectableArea and building to web with canvaskit, worked really well. Even table inside tables was selecting how you'd intuitively expect.

Sub6Resources commented 2 years ago

That API definitely looks neat. I'll give it a try myself later today! I think if we can remove the burden of Selection logic from our library as much as possible, that would be best.

asmith20002 commented 2 years ago

I've tried it briefly and it looks like it gets the job done :)

btw it is SelectionArea, not SelectableArea (the api document link is correct though)

windows7lake commented 1 year ago

3.0.0 is not supported with SelectionArea. Caused by fix: Fix issue with font scaling introduced in 3.0.0-alpha.6 (#1173).