Google Play按钮在Flutter App上不可见



我使用的包- pay: ^1.0.8

当我在连接到真实设备的终端中运行adb log-cat并且Google Pay按钮不可见而触发childOnError时,此错误似乎即将到来。

下面是错误-

04-01 02:23:13.308 3020 15516 W TapAndPay: shouldEnableGooglePay: false [CONTEXT service_id=79 ]
04-01 02:23:13.308 3020 15516 I TapAndPay: Disabling TapAndPay HCE service [CONTEXT service_id=79 ]
04-01 02:23:13.375 3020 15516 W TapAndPay: shouldEnableGooglePay: false [CONTEXT service_id=79 ]
04-01 02:23:13.376 3020 15516 I TapAndPay: Disabling TapAndPay HCE service [CONTEXT service_id=79 ]
04-01 02:23:13.400 3020 15516 W TapAndPay: shouldEnableGooglePay: false [CONTEXT service_id=79 ]
04-01 02:23:13.400 3020 15516 I TapAndPay: Disabling TapAndPay HCE service [CONTEXT service_id=79 ]
04-01 02:23:13.409 3020 15516 W TapAndPay: shouldEnableGooglePay: false [CONTEXT service_id=79 ]
04-01 02:23:13.409 3020 15516 I TapAndPay: Disabling TapAndPay HCE service [CONTEXT service_id=79 ]
04-01 02:23:39.243 3020 15516 W TapAndPay: shouldEnableGooglePay: false [CONTEXT service_id=79 ]
04-01 02:23:39.243 3020 15516 I TapAndPay: Disabling TapAndPay HCE service [CONTEXT service_id=79 ]
04-01 02:23:39.267 3020 15516 W TapAndPay: shouldEnableGooglePay: false [CONTEXT service_id=79 ]
下面是UI代码-
GooglePayButton(
paymentConfigurationAsset: 'gpay.json',
paymentItems: [
PaymentItem(
label: 'Pay',
amount: newPlanCost,
status: PaymentItemStatus.final_price,
)
],
width: 200,
height: 50,
style: GooglePayButtonStyle.black,
type: GooglePayButtonType.pay,
margin: const EdgeInsets.only(top: 15.0),
onPaymentResult: (paymentResult) {
print(paymentResult);
voucherCheckoutHandler(
paymentCheckout.newPlanName,
paymentCheckout.newPlanDealAmount,
uid,
);
},
childOnError: Text('Error'),
loadingIndicator: const Center(
child: CircularProgressIndicator(),
),
),

您可以这样尝试

GooglePayButton(
paymentConfigurationAsset:
'default_payment_profile_google_pay.json',
paymentItems: _paymentItems,
style: GooglePayButtonStyle.black,
type: GooglePayButtonType.pay,
margin: const EdgeInsets.only(top: 15.0),
onPaymentResult: onGooglePayResult,
loadingIndicator: const Center(
child: CircularProgressIndicator(),
),
),
ApplePayButton(
paymentConfigurationAsset: 'default_payment_profile_apple_pay.json',
paymentItems: _paymentItems,
style: ApplePayButtonStyle.black,
type: ApplePayButtonType.buy,
margin: const EdgeInsets.only(top: 15.0),
onPaymentResult: onApplePayResult,
loadingIndicator: const Center(
child: CircularProgressIndicator(),
),
),

查看更多git代码:pay-Main.dart

最新更新