enable pinch and zoom in webview_flutter, where to add code snippet [this.webView.getSettings().setBuiltInZoomControls(true);]

Issue

wanna pinch and zoom to webview_flutter

(I know flutter_webview_plugin can do that, but I wanna stick to flutter_webview for other reasons.)

Zoom support #34

Flutter: how to enable gestures in a web view?

Flutter webview plugin – enable pinch zoom

They all mentioned

this.webView.getSettings().setBuiltInZoomControls(true);

this.webView.getSettings().setSupportZoom(true); to allow pinch/zoom.

forgive my stupidity, I can’t find where to add this code snippet, please help.

Solution

Download this repository: https://github.com/FisherWL/plugins/tree/add-zoom (thanks FisherWL)

copy the folder webview_flutter located inside packages to your project root folder,

then on the pubspec.yaml reference the folder like this:

  webview_flutter:
    path: ./webview_flutter

Answered By – Otávio Garrido

Answer Checked By – Candace Johnson (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *