-
Notifications
You must be signed in to change notification settings - Fork 938
Closed
Description
My setup uses two WebviewScaffold
s with different url
s in such a way that Flutter will not rebuild the WebviewScaffold
widget but simply change the properties. Neither initState
nor dispose
is called and therefore the plugin will not notice that the URL has been changed. Please also implement didUpdateWidget
to deal with that fact.
The implementation below seems to work but I don't know whether it is okay to simply copy the rather longish call from build
. I tried to call webviewReference.reloadUrl
but that didn't work.
@override
void didUpdateWidget(WebviewScaffold oldWidget) {
super.didUpdateWidget(oldWidget);
if (oldWidget.url != widget.url) {
webviewReference.launch(widget.url,
headers: widget.headers,
withJavascript: widget.withJavascript,
clearCache: widget.clearCache,
clearCookies: widget.clearCookies,
enableAppScheme: widget.enableAppScheme,
userAgent: widget.userAgent,
rect: _rect,
withZoom: widget.withZoom,
withLocalStorage: widget.withLocalStorage,
withLocalUrl: widget.withLocalUrl,
scrollBar: widget.scrollBar);
}
}