-
-
Notifications
You must be signed in to change notification settings - Fork 917
Add the ability for iframe to switch url if HTML data changes #539
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 the ability for iframe to switch url if HTML data changes #539
Conversation
lib/src/replaced_element.dart
Outdated
} | ||
} | ||
|
||
/// Create a webview controller and old src independent of [IframeContentElement] |
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.
🤔 What if you have two iframes? Does this work (independently)?
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.
Hah that's something very important that I overlooked. I'm going to mark this as a draft and come back to it.
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.
@erickok turns out you only need to assign a key
to make it work right, as @The-Redhat commented on #337. Now it should work independently!
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.
Wait but now the whole Html widget is controlled by the single key... What is the impact of this?
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.
I only assigned the key to the WebView. Each WebView will get a different key when a new IframeContentElement
class is created.
lib/src/replaced_element.dart
Outdated
final double width; | ||
final double height; | ||
final NavigationDelegate navigationDelegate; | ||
final GlobalKey key = GlobalKey(); |
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.
Does it have to be a global key? Pretty sure this can be an ObjectKey.
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.
Sure it could be any sort of Key
. Is there an advantage to using one type over another?
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.
Yes, for efficiency.
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.
@erickok changed the key to UniqueKey
, its essentially the same as ObjectKey
but doesn't require an Object
argument.
Fixes #337