Flutter Thepeer
此包可轻松在 Flutter 项目中使用 Thepeer。
屏幕截图



如何使用插件
ThePeer 发送
- 在 bottom_sheet 中启动 ThepeerSendView
import 'package:thepeer_flutter/thepeer_flutter.dart';
void launch() async {
await ThepeerSendView(
data: ThePeerData(
amount: 10000,
firstName: '$firstName',
receiptUrl: '$receiptUrl',
publicKey: '$publicKey',
userReference: '$userReference',
),
showLogs: true,
onClosed: () {
Navigator.pop(context);
},
onSuccess: () {
Navigator.pop(context);
},
).show(context);
}
- 使用 ThepeerView 组件
import 'package:thepeer_flutter/thepeer_flutter.dart';
...
ThepeerSendView(
data: ThePeerData(
amount: 10000,
firstName: '$firstName',
receiptUrl: '$receiptUrl',
publicKey: '$publicKey',
userReference: '$userReference',
),
onClosed: () {
Navigator.pop(context);
print('Widget closed')
},
onSuccess: () {
Navigator.pop(context);
},
error: Text('Error'),
)
...
ThePeer DirectCharge
- 在 bottom_sheet 中启动 ThepeerDirectChargeView
import 'package:thepeer_flutter/thepeer_flutter.dart';
void launch() async {
await ThepeerDirectChargeView(
data: ThePeerData(
amount: 10000,
firstName: '$firstName',
publicKey: '$publicKey',
userReference: '$userReference',
),
showLogs: true,
onClosed: () {
Navigator.pop(context);
},
onSuccess: () {
Navigator.pop(context);
},
).show(context);
}
- 使用 ThepeerView 组件
import 'package:thepeer_flutter/thepeer_flutter.dart';
...
ThepeerDirectChargeView(
data: ThePeerData(
amount: 10000,
firstName: '$firstName',
publicKey: '$publicKey',
userReference: '$userReference',
),
onClosed: () {
Navigator.pop(context);
print('Widget closed')
},
onSuccess: () {
Navigator.pop(context);
},
error: Text('Error'),
)
...