flulm_auth 0.2.2 flulm_auth: ^0.2.2 copied to clipboard
The version of the flutter SDK licensed by lemapay is currently only available for the Android system, to be added to the iOS system call.
import 'package:flulm_auth/flulm_auth.dart' as flulmAuth;
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
String _code = 'Unknown';
String _appId = "2003252132219126236";
@override
void initState() {
super.initState();
flulmAuth.register(appId: _appId);
flulmAuth.responseFromAuth.listen((data) {
setState(() {
_code = data.code;
});
});
flulmAuth.responseFromPay.listen((data) {
setState(() {
print("支付回调======:" +
data.errStr +
",errCode=" +
data.errCode.toString());
});
});
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: Test(),
floatingActionButton: FloatingActionButton(
child: Icon(Icons.add),
onPressed: () {
// sendPay(context);
// context,
// PageRouteBuilder(
// transitionDuration: Duration(milliseconds: 300), //动画时间为500毫秒
// pageBuilder: (BuildContext context, Animation animation,
// Animation secondaryAnimation) {
// return Browser(url: "https://www.baidu.com");
// },
// ),
// );
}),
),
);
}
void sendAuth() {
flulmAuth.sendAuth(scope: "login");
}
}
class Test extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Center(
child: RaisedButton(
onPressed: () {
sendPay(context);
},
child: Text("asda"),
),
);
}
void sendPay(BuildContext context) {
flulmAuth.sendPay(
mContext: context,
openId: "2003252132219126236",
appKey: "e61956c42774eaa2d6359a3d377c5bad",
prepayId: "2003262001319289588",
coOrderId: "1585224080764",
payH5Url:
"http://payapi1.lemajestic.com/h5/?order_id=2003262001319289588&co_order_id=1585224080764&amount=66&pay_amount=66¤cy_code=USD&addtime=1585224091&shop_name=langrensha&subject=%E5%A5%BD%E6%B6%88%E6%81%AF%E5%A5%BD%E6%B6%88%E6%81%AF%EF%BC%8C%E5%95%86%E5%93%81%E5%A4%A7%E7%94%A9%E5%8D%96&app_id=2003252132219126236&status=-1&pay_status=0¤cy_name=%E7%BE%8E%E5%85%83&sign=436D66E76547A50358C36FE6C9B6748D&type=h5paypackageValue:com.awesome.lemapaysdkdemo",
packageValue: "com.awesome.flulm_auth_example",
nonceStr: "random_nonce",
timeStamp: "1585224091841",
);
}
}