paypal - 通过 webview flutter Paypal

标签 paypal webview flutter

我正在尝试通过 WebView 为我的 flutter 应用程序集成 Paypal 支付。

return new MaterialApp(
routes: {
"/": (_) => new WebviewScaffold(
  url: "https://www.paypal.com/cgi-bin/webscr?    business=xxxx.com&cmd=_xclick&item_name=Hot+Sauce-12oz.+Bottle&amount=5.95&currency_code=USD",
  appBar: new AppBar(
    title: new Text(
      "Payment",
    ),
  ),
)
},
);

当我运行该页面时,应用程序意外关闭并显示错误消息

Unsupported value: <FlutterError: 0x1c422d200> of type FlutterError Lost connection to device.

这是我的 flutter 医生。

Running flutter doctor...
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, v0.5.1, on Mac OS X 10.13.1 17B1003, locale en-HK)
[✓] Android toolchain - develop for Android devices (Android SDK 26.0.2)
[✓] iOS toolchain - develop for iOS devices (Xcode 9.2)
[✓] Android Studio (version 3.1)
[✓] Connected devices (3 available)

最佳答案

您忘记了 MaterialApp 中的 initialRoute 参数 正确的做法是:

return new MaterialApp(
       initialRoute: '/',
       routes: {
        "/": (_) => new WebviewScaffold(
              url: "https://www.paypal.com/",
              appBar: new AppBar(
                title: new Text(
                  "Payment",
                ),
              ),
            )
        },
);

关于paypal - 通过 webview flutter Paypal ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51647174/

相关文章:

dart - 如何在 flutter 中将泛型类型作为参数传递给 Future

mysql - nodejs-mysql 文件中无效的 utf8 字符字符串加载数据

paypal - 通过 Express Checkout 定期付款订阅网站

android - 在 WebView 的 div 上禁用橙色突出显示

android - WebView 不会在 Lollipop 设备上显示 JSAlert

audio - flutter ( Dart ): Get/Record audio stream from microphone and play it back immediately (real-time)

paypal - 在线接受付款并存储信用卡信息

Paypal 标准 API,从英国到美国

java - 如何使地理定位 webview 始终询问权限?

dart - flutter 路由