'Disable only touch input in a Webview in Flutter
i've created a Webview widget and i want only to disable touch input, but not scrolling i tried with the classes "ignorePointer" and "AbsorbPointer", but that disable all input. the code sample below, load me a page (twitter-timeline), i want to be able to scrolldown the tweets. Any Solution for this?
Thanks in advance!
IgnorePointer(
child: WebView(
javascriptMode: JavascriptMode.unrestricted,
initialUrl: '',
onWebViewCreated: (WebViewController webViewController) {
_controller = webViewController;
_loadHtmlFromAssets();
},
),
)
Solution 1:[1]
Maybe a little bit late, but I have the same issue and I solved it by restricting the navigation while the user taps a link:
@override
Widget build(BuildContext context) {
return WebViewPlus(
initialUrl: filePath,
javascriptMode: JavascriptMode.unrestricted,
onWebViewCreated: (WebViewPlusController webViewController) {
_webViewController = webViewController;
},
navigationDelegate: (NavigationRequest request) {
if (request.url.startsWith('https://platform.twitter.com/widgets/widget_iframe') ||
request.url.startsWith('about:blank') ||
request.url.startsWith("http://localhost")) {
print('allowing navigation to $request}');
return NavigationDecision.navigate;
}else {
print('denying navigation to $request}');
return NavigationDecision.prevent;
}
},
);
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | jmartinalonso |
