flulm_auth 1.0.2 copy "flulm_auth: ^1.0.2" to clipboard
flulm_auth: ^1.0.2 copied to clipboard

outdated

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.

example/lib/main.dart

import 'package:flulm_auth/flulm_auth.dart' as flulmAuth;
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_stetho/flutter_stetho.dart';

void main() => runApp(MaterialApp(
      home: MyApp(),
    ));

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String _code = 'Unknown';
  String _appId = "1911131949173836111";

  @override
  void initState() {
    super.initState();
    Stetho.initialize();
    flulmAuth.register(appId: _appId);
    flulmAuth.responseFromAuth.listen((data) {
      setState(() {
        _code = data.code;
      });
    });
    flulmAuth.responseFromPay.listen((data) {
      setState(() {
        _code = data.toString();
//        print("支付回调======:" +
//            data.errStr +
//            ",errCode=" +
//            data.errCode.toString());
      });
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Plugin example app'),
      ),
      body: Center(
        child: Text('callback code= $_code\n'),
      ),
      floatingActionButton: FloatingActionButton(
          child: Icon(Icons.add),
          onPressed: () {
            sendPay(context);
//            sendAuth(context);
          }),
    );
  }

  void sendAuth(BuildContext context) async {
    print("开始授权=》");
    flulmAuth.sendAuth(
      mContext: context,
      openId: _appId,
      supportScan: true,
      scope: "login",
      isTest: 2,
    );
  }

  void sendPay(BuildContext context) async {
    flulmAuth.sendPay(
      mContext: context,
      openId: _appId,
      supportScan: true,
      signData:
          "{\"uid\":\"84eeb5d23c741ea9cda9f19eae5878f0\",\"rid\":\"ca3e7d7e6c96d4b5c00682f979b6aae9\",\"order_id\":\"2006181540184800879\",\"app_id\":\"1903091622305700195\",\"timestamp\":1592472665,\"nonce_str\":\"sWaYDxjXUInlZbSH\",\"subject\":\"签证办理-1本\",\"sign\":\"D0629DBF67B3FD50714AB973A8247F0C\"}",
      isTest: 2,
    );
  }
}
2
likes
0
pub points
20%
popularity

Publisher

unverified uploader

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.

Homepage

License

unknown (LICENSE)

Dependencies

dio, flutter, logger, webview_flutter

More

Packages that depend on flulm_auth