internal 0.0.5 copy "internal: ^0.0.5" to clipboard
internal: ^0.0.5 copied to clipboard

bravo merchant internal plugin

example/lib/main.dart

import 'package:flutter/material.dart';
import 'dart:async';

import 'package:flutter/services.dart';
import 'package:internal/internal.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String _platformVersion = 'Unknown';
  String _barcodeResult = 'Unknown';
  final _internalPlugin = Internal();

  @override
  void initState() {
    super.initState();
    initPlatformState();
  }

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initPlatformState() async {
    String platformVersion;
    String barcodeResult;
    // Platform messages may fail, so we use a try/catch PlatformException.
    // We also handle the message potentially returning null.
    try {
    /*Map order = {
      'method':'pay',
      'amount':1,
      'isMerchant':false,
      'tip':0,
      'address':'7440 Fraser Park Dr, Burnaby, BC V5J 5B9',
      'name':'IOTPAY',
      'orderno':'WM20240111001328490423881796',
      'datetime':'2024-01-10 16:13',
       'msg':'此二维码用于退款',
      'labelMerchantCopy':'商户存根',
      'labelPayType':'交易类型',
      'labelPayDate':'交易时间',
      'labelOrderNO':'支付订单号',
      'labelTip':'小费',
      'labelSubTotal':'实付金额',
      'labelTotal':'总金额'
    };
    Map refund = {
      'method':'refund',
      'refundamount':1,
      'isMerchant':false,
      'name':'IOTPAY',
      'orderno':'RN2024011100132849042383434',
      'ordernoOriginal':'WM20240111001328490423881796',
      'datetime':'2024-01-10 16:13',
      'msg':'This QR Code is used for refund',
      'labelMerchantCopy':'商户存根',
      'labelPayType':'交易类型',
      'labelPayDate':'交易时间',
      'labelOrderNOOriginal':'支付订单号',
      'labelOrderNO':'退款订单号',
      'labelRefundAmount':'退款金额'
    };*/
    /*List list = [
      {'msg':'大字体:\$100','type':'big'},
      {'msg':'普通字体:test','type':''},
      {'msg':'','type':'line'},
      {'msg':'abarcodetest','type':'qrcode'},
    ];*/
    List<Map> list = [
      {
        'msg': '店名',
        'type': 'big',
      },
       /* {
          'msg': '店地址',
          'type': '',
        },
        {
          'msg': 'zipcode',
          'type': '',
        },
        {
          'msg': '电话',
          'type': '',
        },
      {
        'msg': '',
        'type': 'line',
      },
      {
        'msg': 'Order#: 订单号',
        'type': '',
      },
      {
        'msg': 'Order Amount: 100元',
        'type': '',
      },
      {
        'msg': 'TXN: 流水号',
        'type': '',
      },
      {
        'msg': 'Payment Method: 支付方式',
        'type': '',
      },
      {
        'msg': 'Payment Code: 支付码',
        'type': '',
      },
      {
        'msg': 'Payment: 实付额}',
        'type': 'big',
      },
      {
        'msg': '流水号',
        'type': 'qrcode',
      },*/
    ];
    platformVersion = "";
      /*platformVersion =
          await _internalPlugin.internalRequest(list) ?? 'Unknown';*/
    barcodeResult = "";
    Map data = {"isManualEntry":false,"s0":"标题","s1":"二标题","s2":"提示"};
    barcodeResult =
        await _internalPlugin.scanBarcode(data) ?? 'Unknown';

    } on Exception {
      platformVersion = 'Failed to get request reault.';
      barcodeResult = 'Failed to get request reault.';
    }




    // If the widget was removed from the tree while the asynchronous platform
    // message was in flight, we want to discard the reply rather than calling
    // setState to update our non-existent appearance.
    if (!mounted) return;

    setState(() {
      _platformVersion = platformVersion;
      _barcodeResult = barcodeResult;
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Text('result: $_platformVersion $_barcodeResult\n'),
        ),
      ),
    );
  }
}
1
likes
0
points
108
downloads

Publisher

unverified uploader

Weekly Downloads

bravo merchant internal plugin

Homepage

License

unknown (license)

Dependencies

flutter, flutter_web_plugins, plugin_platform_interface

More

Packages that depend on internal