小编Ala*_*nez的帖子

flutter inappwebviewencodeURL 在 Android 中具有错误的字符串,而它在 iOS 中工作正常?

我在我们的应用程序中使用了 inappwebview 。我在iOS和Android的shouldOverrideUrlLoading方法中得到了不同的encodedUrl。虽然在 iOS 中它工作正常,但在 Android 中它没有给出正确的 url。

\n

编码后的URL

\n

iOS: %22坐标%22:%22%7B%5C%22y1%5C%22:193.0,%5C%22x1%5C%22:491.0,%5C%22y2%5C%22:162.0,%5C%22x2%5C %22:522.0%7D%22

\n

android : %22坐标%22:%22%7B/%22y1/%22:521.0,/%22x1/%22:753.0,/%22y2/%22:490.0,/%22x2/%22:784.0%7D%22

\n

解码后的URL

\n

iOS: "坐标" : "{"y1":521.0,"x1":753.0,"y2":490.0,"x2":784.0}"

\n

android: "坐标": "{/"y1/":521.0,/"x1/":753.0,/"y2/":490.0,/"x2/":784.0}"

\n

我得到了 iOS 和 Android 的不同编码字符串。您可以看到 \xe2\x80\x9ccoordinates\xe2\x80\x9d 值,对于 iOS,它是“%5C”,对于 Android,它是“/”。

\n
InAppWebView(\n          key: webViewKey,\n          initialUrlRequest: URLRequest(url: Uri.parse(widget.url)),\n          initialOptions: inAppWebViewGroupOptions(),\n          onWebViewCreated: (InAppWebViewController webViewController) async {\n            _appWebViewController = webViewController;\n            if (widget.onWebViewCreated != null) {\n              widget.onWebViewCreated!(_appWebViewController!);\n            }\n          },\n          onLoadStart: (InAppWebViewController controller, Uri? url) async {\n            if (widget.onProgressChanged != null) {\n              widget.onPageStarted!(url.toString());\n            }\n …
Run Code Online (Sandbox Code Playgroud)

android ios flutter flutterwebviewplugin flutter-inappwebview

7
推荐指数
0
解决办法
266
查看次数