here I get the initial URL height, but when I go to another URL using webviewController.loadUrl() its doesn't change height, how can I found loadUrl height
here the initial URL code:
SizedBox(
height: _heights,
child: WebView(
initialUrl: initialUrl,
javascriptMode: JavascriptMode.unrestricted,
onPageFinished: (some) async {
double height = double.parse(await webViewController!
.runJavascriptReturningResult(
"document.documentElement.scrollHeight;"));
setState(() {
_heights = height;
});
},
onWebViewCreated: (controller) {
webViewController = controller;
},
onProgress: (progress) => setState(
() {
Progress = progress / 100;
},
),
),
),
and here the load URL code:
Card(
child: ListTile(
leading: const Icon(Icons.phone),
onTap: () {
webViewController!.loadUrl(contact);
scaffoldKey.currentState?.openEndDrawer();
},
title: Transform.translate(
offset: const Offset(-16, 0),
child: const Text('Contact Us',
style: TextStyle(fontSize: 15.0)),
),
),
),
Pass the height as a query parameter in your url. and use that to update the screen height of your Webview.
URL : domain.xyz/?height=100 like this
In flutter widget