微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Flutter Stripe本机付款崩溃

如何解决Flutter Stripe本机付款崩溃

我正试图接受本机苹果付款,我一直关注pubdev并在那里建立示例。我已经尝试过以这种方式在自己的应用中实现本机付款:

Scaffold(body: ListView(....),floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,floatingActionButton: Container(
        width: 100,height: 100,child: FloatingActionButton(
            splashColor: Colors.red,backgroundColor: Colors.white,child: const Icon(
              Icons.payment,color: Colors.red,size: 50.0,),onpressed: ()  async {
              Token paymentToken = await StripePayment.paymentRequestWithNativePay(
                androidPayOptions: null,applePayOptions: ApplePayPaymentOptions(
              countryCode: 'US',currencyCode: 'USD',items: [
              ApplePayItem(
              label: 'Test',amount: '13',)
              ],));
              print(paymentToken.toString());
            }),)

ListView根据选择的项目动态呈现Card窗口小部件。当我按浮动操作按钮进行购买时,应用崩溃。我收到此错误

Lost connection to device.
*** First throw call stack:
(
    0   CoreFoundation                      0x00007fff23e3cf0e __exceptionPreprocess + 350
    1   libobjc.A.dylib                     0x00007fff50ba89b2 objc_exception_throw + 48
    2   UIKitCore                           0x00007fff485f256e -[UIViewController _presentViewController:withAnimationController:completion:] + 5218
    3   UIKitCore                           0x00007fff485f4a2e __63-[UIViewController _presentViewController:animated:completion:]_block_invoke + 98
    4   UIKitCore                           0x00007fff485f4f37 -[UIViewController _performCoordinatedPresentOrdismiss:animated:] + 511
    5   UIKitCore                           0x00007fff485f498c -[UIViewController _presentViewController:animated:completion:] + 187
    6   UIKitCore                           0x00007fff485f4bf8 -[U<…>

我认为我的浮动操作按钮妨碍了苹果动画。我想将浮动按钮保留在那里,它看起来非常不错。任何帮助都将非常棒,谢谢!

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。