How to remove scrolling horizontally in flutter webview

Viewed 29

I have a webview wrapped with stack and I will like to stop the strolling from left to right but couldn't work around this tho I tried using the below code to wrap it

GestureDetector(
    onHorizontalDragUpdate: (updateDetails) {},
    child:WebView())

But this stops scrolling from up to down as a result when the content is longer then users won't be able to scroll up and down, find below my code:

Stack(children: [

        GestureDetector(
    onHorizontalDragUpdate: (updateDetails) {},
    child:WebView(
          javascriptMode:JavascriptMode.unrestricted,
          initialUrl: url+"?"+getUrl,
          onWebViewCreated: (WebViewController webViewController) {
            _controller.complete(webViewController);
          },
          javascriptChannels: Set.from([
        JavascriptChannel(
        name: 'Print',
            onMessageReceived: (JavascriptMessage message) {
              print(message.message);

            })
      ]),
         
        )),
        (loading==false)?Container():Container(
            padding: EdgeInsets.all(20),
            child: LinearProgressIndicator(
                valueColor:
                new AlwaysStoppedAnimation<
                    Color>(
                  Colors.blue,
                ),
                backgroundColor: colorBlue))
      ],)


Can anyone help to solve this so only scrolling left to right will be restricted? Thanks in advance.

0 Answers
Related