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 815 forks source link

[QUESTION] Can IframeWidget resize after content loads? #1346

Open swiftymf opened 10 months ago

swiftymf commented 10 months ago

Is it possible to have the flutter_html_iframe resize after the content has loaded? I've read through the README, issues, Googles, and haven't been able to find a solution. Maybe there something I am missing or possibly a feature that might be added later?

On other issues I saw that this package won't run Javascript, but many of the solutions that I've come across include executing JS within the iFrame.

For example, I'm loading a Twitter card in an iFrame. It utilizes a Twitter script that takes a second to load. In 3.0.0-beta.2, I'm aware of being able to pass in a NavigationDelegate, but the onPageFinished executes the callback before the Twitter script finishes executing.

Open to helping find a solution if one doesn't exist.

Thanks!

A picture of a cute animal (not mandatory but encouraged) Rosie

erickok commented 10 months ago

Yes and no. There's nothing that this flutter_html package can help with, as it's a question about using a WebView. You can certainly do this via the WebView delegate and have it resize the Widget based on the contents, but that's outside the scope of this package which is to render html as native widgets.

swiftymf commented 10 months ago

@erickok Thanks for the response!

I ended up making a new branch with a couple commits that accomplish what I need. I believe that the changes are still within the scope of the package, but also add some useful functionality. I would greatly appreciate feedback and hopefully a merge if everything looks good.

https://github.com/Sub6Resources/flutter_html/pull/1349

Thanks!