加载Webview时Flutter应用崩溃

时间:2019-12-31 05:42:17

标签: flutter webview

我正在尝试从Flutter应用程序的webView中打开付款网址链接,但在输入输入字段时崩溃了。

return Scaffold(
          body: new MyWebView(
            selectedUrl:"https://easternbank.ap.gateway.mastercard.com/checkout/pay/SESSION0002887307683L1130761K87",),
        );

我们的MyWebView小部件是:

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

class MyWebView extends StatelessWidget {
  final String selectedUrl;
  final Completer<WebViewController> _controller =  Completer<WebViewController>();
  MyWebView({
    @required this.selectedUrl,
  });

  @override
  Widget build(BuildContext context) {
    bool isLoading = true;
    return StatefulBuilder(
        builder: (BuildContext context, StateSetter setState) {
          return Scaffold(
            body: Stack(
              children: <Widget>[
                //new LinearProgressIndicator(),
                new WebView(
                  initialUrl: selectedUrl,
                  javascriptMode: JavascriptMode.unrestricted,
                  onWebViewCreated: (WebViewController webViewController) {
                    _controller.complete(webViewController);
                  },
                  onPageFinished: (finised) {
                    setState(() {
                      isLoading = false;
                    });
                  },
                ),
                isLoading ? _loadingScreen() : Container(),
              ],
            ),
          );
        });
  }

用于安全付款页面的webView是否存在任何问题?

通常是在尝试在页面中输入内容时发生的

一些调试错误:

Build fingerprint: 'google/sdk_gphone_x86/generic_x86:9/PSR1.180720.075/5124027:user/release-keys'
Revision: '0'
ABI: 'x86'
pid: 10040, tid: 10040, name: cker.my_payment  >>> com.gomaxtracker.my_payment <<<
signal 4 (SIGILL), code 2 (ILL_ILLOPN), fault addr 0xd247d0d0
Abort message: '[FATAL:jni_android.cc(256)] Please include Java exception stack in crash report
'    eax 00000000  ebx d4e06e2c  ecx cbbe3320  edx 00000400
    edi ff9eefe8  esi ff9eebb8
    ebp ff9eeb71  esp ff9eeb70  eip d247d0d0
backtrace:
    #00 pc 023310d0  /system/app/Chrome/Chrome.apk (offset 0x1022000)

1 个答案:

答案 0 :(得分:0)

  

安全付款页面的webView是否存在任何问题?

     

不。但是,当网页中包含 DropDown 时,此功能目前不起作用。

不幸的是,由于您的应用在下拉菜单中崩溃,因此官方插件未解决此问题, 此问题正在herehere进行讨论,尚未解决,

所以我建议使用flutter_webview_plugin

示例

 WebviewScaffold(
      url: "https://easternbank.ap.gateway.mastercard.com/checkout/pay/SESSION0002887307683L1130761K87",
      ),