Skip to content

Instantly share code, notes, and snippets.

@hassanannajjar
Last active August 31, 2021 14:24
Show Gist options
  • Save hassanannajjar/97523e97cb0a8eabfe7bb19ba86c4858 to your computer and use it in GitHub Desktop.
Save hassanannajjar/97523e97cb0a8eabfe7bb19ba86c4858 to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
import 'package:pay/pay.dart';
class MyHomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Apple Pay Example'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
ApplePayButton(
paymentConfigurationAsset: 'applepay.json',
paymentItems: _paymentItems,
style: ApplePayButtonStyle.black,
type: ApplePayButtonType.buy,
width: 200,
height: 50,
margin: const EdgeInsets.only(top: 15.0),
onPaymentResult: (value) {
print(value);
},
onError: (error) {
print(error);
},
loadingIndicator: const Center(
child: CircularProgressIndicator(),
),
),
],
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment