internal 0.0.9
internal: ^0.0.9 copied to clipboard
bravo merchant internal plugin
example/lib/main.dart
import 'package:flutter/material.dart';
import 'dart:async';
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 String _barcodeResult = 'Unknown';
late BuildContext _context;
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 {
List list1 = [
{'msg': 'HAIDILAO Richmond', 'type': 'big'},
{'msg': '海底捞 - 列治文店', 'type': 'big'},
{'msg': '5890 No.3Rd Room 200 Richmond, BC. V6X 3P6', 'type': ''},
{'msg': '6043706665', 'type': ''},
{'msg': '', 'type': 'line'},
{'msg': 'Order#: O17104609576091149', 'type': ''},
{'msg': 'TXN: 17104609576091149', 'type': ''},
{'msg': 'Payment Method: QR Code', 'type': ''},
{'msg': 'Payment Code: V***9351', 'type': ''},
{'msg': 'Total: \$0.01', 'type': 'big'},
{
'msg': 'https://bravoupca/gift/24489d1eb106te10317fbb216b49bft5',
'type': 'qrcode'
},
];
platformVersion = "";
platformVersion =
await _internalPlugin.internalRequest(list1) ?? 'Unknown';
} on Exception {
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;
});
}
getBody(context) {
_context = context;
return Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: Center(
child: Column(children: [
Text('result: $_platformVersion $_barcodeResult\n'),
ElevatedButton(
onPressed: () {
int time = 1712001396000;
int yesterday = time - 86400000;
int nowtime = time;
int yesterdaytime = yesterday;
int lasttime = 10000;
nowtime += lasttime;
yesterdaytime += lasttime;
List list1 = [
{
'type': 'table',
'name': 'historytransaction',
'title': 'Transaction',
'where':
'entrytime=@thisyear order by entrytime desc', //'2024-03-13'
'orderby': 'date desc',
'orderasc': 'desc',
'columns': [
{
"id": "entrytime",
"dbid": "entrytime",
"type": "datetime",
"label": "Date",
"defaultValue": "",
"required": false,
"minLength": 0,
"length": 255,
"hash": false,
"unit": "character",
"prefixIcon": null,
"inputType": "datetime",
"fontSize": null,
"letterSpacing": 0.0,
"isPrimary": false,
"isKeyword": false,
"droplist": "",
"uniqueKey": "",
"isUnique": false,
"colType": "java.lang.Long",
"isFile": false,
"seq": 10,
"canshow": true,
"fromsource": "",
"isFrozen": false,
"addNewCheck": false,
"isWholePage": false,
"after": "",
"showrange": "table",
"Advanced search": true,
},
{
"id": "amount",
"dbid": "amount",
"type": "money",
"label": "Amount",
"defaultValue": "",
"required": false,
"minLength": 0,
"length": 80,
"hash": false,
"unit": "character",
"prefixIcon": null,
"inputType": "money",
"fontSize": null,
"letterSpacing": 0.0,
"isPrimary": false,
"isKeyword": false,
"droplist": "",
"uniqueKey": "",
"isUnique": false,
"colType": "java.lang.Long",
"isFile": false,
"seq": 20,
"canshow": true,
"fromsource": "",
"isFrozen": false,
"addNewCheck": false,
"isWholePage": false,
"after": "",
"showrange": "",
"sumtype": "sum",
},
{
"id": "tip",
"dbid": "tip",
"type": "money",
"label": "Tip",
"defaultValue": "",
"required": false,
"minLength": 0,
"length": 80,
"hash": false,
"unit": "character",
"prefixIcon": null,
"inputType": "money",
"fontSize": null,
"letterSpacing": 0.0,
"isPrimary": false,
"isKeyword": false,
"droplist": "",
"uniqueKey": "",
"isUnique": false,
"colType": "java.lang.Long",
"isFile": false,
"seq": 30,
"canshow": true,
"fromsource": "",
"isFrozen": false,
"addNewCheck": false,
"isWholePage": false,
"after": "",
"showrange": "",
"sumtype": "sum",
},
],
'data': [
{
'entrytime': '${nowtime + lasttime * 1}',
'amount': 1861,
'tip': 100
},
{
'entrytime': '${yesterdaytime + lasttime * 1}',
'amount': 2031,
'tip': 150
},
{
'entrytime': '${nowtime + lasttime * 2}',
'amount': 561,
'tip': 50
},
{
'entrytime': '${yesterdaytime + lasttime * 2}',
'amount': 706,
'tip': 108
},
{
'entrytime': '${nowtime + lasttime * 3}',
'amount': 61,
'tip': 1
},
{
'entrytime': '${yesterdaytime + lasttime * 3}',
'amount': 27061,
'tip': 380
},
{
'entrytime': '${nowtime + lasttime * 4}',
'amount': 37061,
'tip': 480
},
{
'entrytime': '${yesterdaytime + lasttime * 4}',
'amount': 8061,
'tip': 108
},
{
'entrytime': '${nowtime + lasttime * 5}',
'amount': 9061,
'tip': 109
},
{
'entrytime': '${nowtime + lasttime * 6}',
'amount': 10061,
'tip': 1180
},
{
'entrytime': '${yesterdaytime + lasttime * 5}',
'amount': 11061,
'tip': 1280
},
{
'entrytime': '${nowtime + lasttime * 7}',
'amount': 12061,
'tip': 1380
},
],
'context': _context,
},
];
_internalPlugin.internalRequest(list1);
},
child: const Text('table Example'))
]),
),
);
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Builder(builder: (context) => getBody(context)),
);
}
}