internal 0.0.2
internal: ^0.0.2 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';
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;
// 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'},
];
platformVersion =
await _internalPlugin.internalRequest(list) ?? 'Unknown';
} on PlatformException {
platformVersion = '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;
});
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: Center(
child: Text('Running on: $_platformVersion\n'),
),
),
);
}
}