Web视图不允许滚动到页面?

时间:2019-12-11 11:11:55

标签: flutter flutterwebviewplugin

向大家致意,

我正在构建Flutter应用程序,就像简而言之,该应用程序包含水平三个页面的综合浏览量,因此用户可以滑动页面,现在第三页是一个Webview,用户可以阅读新闻或他们想要的任何内容。

这里是代码:-

import 'package:flutter/foundation.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:webview_flutter/webview_flutter.dart';
import 'dart:async';
import 'global.dart';

class WebViewHold extends StatefulWidget {
  final PageController controller;
  final int destination;

  const WebViewHold({Key key, this.controller, Key index, this.destination})
      : super(key: key);
  @override
  _WebViewHoldState createState() => _WebViewHoldState();
}

class _WebViewHoldState extends State<WebViewHold> {
  Completer<WebViewController> _controller = Completer<WebViewController>();

  backToNews() {
    widget.controller.animateToPage(
      1,
      duration: Duration(milliseconds: 100),
      curve: Curves.easeIn,
    );
  }

  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        elevation: 0,
        backgroundColor: Colors.white,
        leading: IconButton(
          icon: Icon(Icons.arrow_back_ios, color: Colors.black),
          onPressed: backToNews,
        ),
      ),
      body: WebView(
        initialUrl: articleLink,
        gestureRecognizers: Set()
          ..add(
            Factory<VerticalDragGestureRecognizer>(
              () => VerticalDragGestureRecognizer(),
            ),
          ),
        initialMediaPlaybackPolicy:
            AutoMediaPlaybackPolicy.require_user_action_for_all_media_types,
        javascriptMode: JavascriptMode.unrestricted,
        onWebViewCreated: (WebViewController webViewController) {
          _controller.complete(webViewController);
        },
      ),
    );
  }
}

Flutter详细信息版本等

   • Flutter version 1.9.1+hotfix.6 at /home/sunnynegi/Downloads/flutter
   • Framework revision 68587a0916 (3 months ago), 2019-09-13 19:46:58 -0700
   • Engine revision b863200c37
   • Dart version 2.5.0

问题是用户无法滚动浏览网络视图吗?

0 个答案:

没有答案