update latest
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import 'dart:developer';
|
import 'dart:developer';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:max_print_plus/max_print_plus.dart';
|
||||||
import 'package:max_print_plus/print/max_print.dart';
|
import 'package:max_print_plus/print/max_print.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
@@ -53,8 +54,7 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
child: Text('Click me')),
|
child: Text('Click me')),
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.push(context,
|
_printReceiveTest(true);
|
||||||
MaterialPageRoute(builder: (context) => MaxPrint()));
|
|
||||||
},
|
},
|
||||||
child: Text('Print page mode')),
|
child: Text('Print page mode')),
|
||||||
],
|
],
|
||||||
@@ -63,220 +63,210 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Future _printReceiveTest(bool isPage) async {
|
Future _printReceiveTest(bool isPage) async {
|
||||||
// List<int> bytes = [];
|
List<int> bytes = [];
|
||||||
|
|
||||||
// // Xprinter XP-N160I
|
// Xprinter XP-N160I
|
||||||
// final profile = await CapabilityProfile.load(name: 'XP-N160I');
|
final profile = await CapabilityProfile.load(name: 'XP-N160I');
|
||||||
|
|
||||||
// // PaperSize.mm80 or PaperSize.mm58
|
// PaperSize.mm80 or PaperSize.mm58
|
||||||
// final generator = Generator(PaperSize.mm58, profile);
|
final generator =
|
||||||
// bytes += generator.setGlobalCodeTable('CP1252');
|
EscGenerator(PaperSizeWidth.mm58, PaperSizeMaxPerLine.mm58, profile);
|
||||||
// bytes += generator.text('MM TOYS',
|
bytes += generator.setGlobalCodeTable('CP1252');
|
||||||
// styles: const PosStyles(align: PosAlign.center, bold: true));
|
bytes += generator.text('MM TOYS',
|
||||||
|
styles: const PosStyles(align: PosAlign.center, bold: true));
|
||||||
|
|
||||||
// bytes += generator.text('Cikijing, Talaga, Bantarujeg, Rancah',
|
bytes += generator.text('Cikijing, Talaga, Bantarujeg, Rancah',
|
||||||
// styles: const PosStyles(align: PosAlign.center, bold: true));
|
styles: const PosStyles(align: PosAlign.center, bold: true));
|
||||||
|
|
||||||
// bytes += generator.row([
|
bytes += generator.row([
|
||||||
// PosColumn(
|
PosColumn(
|
||||||
// width: 6,
|
width: 6,
|
||||||
// text: 'PENJUALAN :',
|
text: 'PENJUALAN :',
|
||||||
// styles: const PosStyles(align: PosAlign.left, codeTable: 'CP1252')),
|
styles: const PosStyles(align: PosAlign.left, codeTable: 'CP1252')),
|
||||||
// PosColumn(
|
PosColumn(
|
||||||
// width: 6,
|
width: 6,
|
||||||
// text: '2024-03-14',
|
text: '2024-03-14',
|
||||||
// styles: const PosStyles(align: PosAlign.right, codeTable: 'CP1252')),
|
styles: const PosStyles(align: PosAlign.right, codeTable: 'CP1252')),
|
||||||
// ]);
|
]);
|
||||||
|
|
||||||
// bytes += generator.row([
|
bytes += generator.row([
|
||||||
// PosColumn(
|
PosColumn(
|
||||||
// width: 8,
|
width: 8,
|
||||||
// text: 'PELANGGAN : UMUM-RCH',
|
text: 'PELANGGAN : UMUM-RCH',
|
||||||
// styles: const PosStyles(align: PosAlign.left, codeTable: 'CP1252')),
|
styles: const PosStyles(align: PosAlign.left, codeTable: 'CP1252')),
|
||||||
// PosColumn(
|
PosColumn(
|
||||||
// width: 4,
|
width: 4,
|
||||||
// text: '15:30',
|
text: '15:30',
|
||||||
// styles: const PosStyles(align: PosAlign.right, codeTable: 'CP1252')),
|
styles: const PosStyles(align: PosAlign.right, codeTable: 'CP1252')),
|
||||||
// ]);
|
]);
|
||||||
|
|
||||||
// bytes += generator.text('--------------------------------',
|
bytes += generator.text('--------------------------------',
|
||||||
// styles: const PosStyles(align: PosAlign.center));
|
styles: const PosStyles(align: PosAlign.center));
|
||||||
// bytes += generator.row([
|
bytes += generator.row([
|
||||||
// PosColumn(
|
PosColumn(
|
||||||
// width: 6,
|
width: 6,
|
||||||
// text: 'Qty',
|
text: 'Qty',
|
||||||
// styles: const PosStyles(align: PosAlign.left, codeTable: 'CP1252')),
|
styles: const PosStyles(align: PosAlign.left, codeTable: 'CP1252')),
|
||||||
// PosColumn(
|
PosColumn(
|
||||||
// width: 6,
|
width: 6,
|
||||||
// text: 'Nama Produk',
|
text: 'Nama Produk',
|
||||||
// styles: const PosStyles(align: PosAlign.left, codeTable: 'CP1252')),
|
styles: const PosStyles(align: PosAlign.left, codeTable: 'CP1252')),
|
||||||
// ]);
|
]);
|
||||||
|
|
||||||
// bytes += generator.row([
|
bytes += generator.row([
|
||||||
// PosColumn(
|
PosColumn(
|
||||||
// width: 3,
|
width: 3,
|
||||||
// text: 'Harga',
|
text: 'Harga',
|
||||||
// styles: const PosStyles(align: PosAlign.right, codeTable: 'CP1252')),
|
styles: const PosStyles(align: PosAlign.right, codeTable: 'CP1252')),
|
||||||
// PosColumn(
|
PosColumn(
|
||||||
// width: 3,
|
width: 3,
|
||||||
// text: 'Dis.',
|
text: 'Dis.',
|
||||||
// styles: const PosStyles(align: PosAlign.right, codeTable: 'CP1252')),
|
styles: const PosStyles(align: PosAlign.right, codeTable: 'CP1252')),
|
||||||
// PosColumn(
|
PosColumn(
|
||||||
// width: 3,
|
width: 3,
|
||||||
// text: 'PPn',
|
text: 'PPn',
|
||||||
// styles: const PosStyles(align: PosAlign.right, codeTable: 'CP1252')),
|
styles: const PosStyles(align: PosAlign.right, codeTable: 'CP1252')),
|
||||||
// PosColumn(
|
PosColumn(
|
||||||
// width: 3,
|
width: 3,
|
||||||
// text: 'Netto',
|
text: 'Netto',
|
||||||
// styles: const PosStyles(align: PosAlign.right, codeTable: 'CP1252')),
|
styles: const PosStyles(align: PosAlign.right, codeTable: 'CP1252')),
|
||||||
// ]);
|
]);
|
||||||
|
|
||||||
// bytes += generator.text('--------------------------------',
|
bytes += generator.text('--------------------------------',
|
||||||
// styles: const PosStyles(align: PosAlign.center));
|
styles: const PosStyles(align: PosAlign.center));
|
||||||
|
|
||||||
// // Dummy transaction data
|
// Dummy transaction data
|
||||||
// List<String> dummyProducts = [
|
List<String> dummyProducts = [
|
||||||
// 'Product 1',
|
'Product 1',
|
||||||
// 'Product 2',
|
'Product 2',
|
||||||
// 'Product 3',
|
'Product 3',
|
||||||
// ];
|
];
|
||||||
|
|
||||||
// for (var productName in dummyProducts) {
|
for (var productName in dummyProducts) {
|
||||||
// bytes += generator.row([
|
bytes += generator.row([
|
||||||
// PosColumn(
|
PosColumn(
|
||||||
// width: 12,
|
width: 12,
|
||||||
// text: '2 ${productName.toUpperCase()}',
|
text: '2 ${productName.toUpperCase()}',
|
||||||
// styles: const PosStyles(
|
styles: const PosStyles(
|
||||||
// align: PosAlign.left,
|
align: PosAlign.left,
|
||||||
// codeTable: 'CP1252',
|
codeTable: 'CP1252',
|
||||||
// )),
|
)),
|
||||||
// ]);
|
]);
|
||||||
|
|
||||||
// bytes += generator.row([
|
bytes += generator.row([
|
||||||
// PosColumn(
|
PosColumn(
|
||||||
// width: 3,
|
width: 3,
|
||||||
// text: '10.0',
|
text: '10.0',
|
||||||
// styles: const PosStyles(align: PosAlign.left, codeTable: 'CP1252')),
|
styles: const PosStyles(align: PosAlign.left, codeTable: 'CP1252')),
|
||||||
// PosColumn(
|
PosColumn(
|
||||||
// width: 3,
|
width: 3,
|
||||||
// text: '0.0',
|
text: '0.0',
|
||||||
// styles:
|
styles:
|
||||||
// const PosStyles(align: PosAlign.right, codeTable: 'CP1252')),
|
const PosStyles(align: PosAlign.right, codeTable: 'CP1252')),
|
||||||
// PosColumn(
|
PosColumn(
|
||||||
// width: 3,
|
width: 3,
|
||||||
// text: '',
|
text: '',
|
||||||
// styles:
|
styles:
|
||||||
// const PosStyles(align: PosAlign.right, codeTable: 'CP1252')),
|
const PosStyles(align: PosAlign.right, codeTable: 'CP1252')),
|
||||||
// PosColumn(
|
PosColumn(
|
||||||
// width: 3,
|
width: 3,
|
||||||
// text: '20.0',
|
text: '20.0',
|
||||||
// styles:
|
styles:
|
||||||
// const PosStyles(align: PosAlign.right, codeTable: 'CP1252')),
|
const PosStyles(align: PosAlign.right, codeTable: 'CP1252')),
|
||||||
// ]);
|
]);
|
||||||
// }
|
}
|
||||||
|
|
||||||
// bytes += generator.text('--------------------------------',
|
bytes += generator.text('--------------------------------',
|
||||||
// styles: const PosStyles(align: PosAlign.center));
|
styles: const PosStyles(align: PosAlign.center));
|
||||||
|
|
||||||
// // Dummy total and payment data
|
// Dummy total and payment data
|
||||||
// bytes += generator.row([
|
bytes += generator.row([
|
||||||
// PosColumn(
|
PosColumn(
|
||||||
// width: 4,
|
width: 4,
|
||||||
// text: 'Jumlah : 3',
|
text: 'Jumlah : 3',
|
||||||
// styles: const PosStyles(align: PosAlign.left, codeTable: 'CP1252')),
|
styles: const PosStyles(align: PosAlign.left, codeTable: 'CP1252')),
|
||||||
// PosColumn(
|
PosColumn(
|
||||||
// width: 4,
|
width: 4,
|
||||||
// text: 'Item : 6',
|
text: 'Item : 6',
|
||||||
// styles: const PosStyles(align: PosAlign.center, codeTable: 'CP1252')),
|
styles: const PosStyles(align: PosAlign.center, codeTable: 'CP1252')),
|
||||||
// PosColumn(
|
PosColumn(
|
||||||
// width: 4,
|
width: 4,
|
||||||
// text: '33.0',
|
text: '33.0',
|
||||||
// styles: const PosStyles(align: PosAlign.right, codeTable: 'CP1252')),
|
styles: const PosStyles(align: PosAlign.right, codeTable: 'CP1252')),
|
||||||
// ]);
|
]);
|
||||||
|
|
||||||
// // Dummy grand total, payment, change, and cashier data
|
// Dummy grand total, payment, change, and cashier data
|
||||||
// bytes += generator.row([
|
bytes += generator.row([
|
||||||
// PosColumn(
|
PosColumn(
|
||||||
// width: 6,
|
width: 6,
|
||||||
// text: 'Grand Total',
|
text: 'Grand Total',
|
||||||
// styles: const PosStyles(align: PosAlign.left, codeTable: 'CP1252')),
|
styles: const PosStyles(align: PosAlign.left, codeTable: 'CP1252')),
|
||||||
// PosColumn(
|
PosColumn(
|
||||||
// width: 1,
|
width: 1,
|
||||||
// text: ':',
|
text: ':',
|
||||||
// styles: const PosStyles(align: PosAlign.left, codeTable: 'CP1252')),
|
styles: const PosStyles(align: PosAlign.left, codeTable: 'CP1252')),
|
||||||
// PosColumn(
|
PosColumn(
|
||||||
// width: 5,
|
width: 5,
|
||||||
// text: '33.0',
|
text: '33.0',
|
||||||
// styles: const PosStyles(align: PosAlign.right, codeTable: 'CP1252')),
|
styles: const PosStyles(align: PosAlign.right, codeTable: 'CP1252')),
|
||||||
// ]);
|
]);
|
||||||
// bytes += generator.row([
|
bytes += generator.row([
|
||||||
// PosColumn(
|
PosColumn(
|
||||||
// width: 6,
|
width: 6,
|
||||||
// text: 'Pembayaran',
|
text: 'Pembayaran',
|
||||||
// styles: const PosStyles(align: PosAlign.left, codeTable: 'CP1252')),
|
styles: const PosStyles(align: PosAlign.left, codeTable: 'CP1252')),
|
||||||
// PosColumn(
|
PosColumn(
|
||||||
// width: 1,
|
width: 1,
|
||||||
// text: ':',
|
text: ':',
|
||||||
// styles: const PosStyles(align: PosAlign.left, codeTable: 'CP1252')),
|
styles: const PosStyles(align: PosAlign.left, codeTable: 'CP1252')),
|
||||||
// PosColumn(
|
PosColumn(
|
||||||
// width: 5,
|
width: 5,
|
||||||
// text: '50.0',
|
text: '50.0',
|
||||||
// styles: const PosStyles(align: PosAlign.right, codeTable: 'CP1252')),
|
styles: const PosStyles(align: PosAlign.right, codeTable: 'CP1252')),
|
||||||
// ]);
|
]);
|
||||||
// bytes += generator.row([
|
bytes += generator.row([
|
||||||
// PosColumn(
|
PosColumn(
|
||||||
// width: 6,
|
width: 6,
|
||||||
// text: 'Kembalian',
|
text: 'Kembalian',
|
||||||
// styles: const PosStyles(align: PosAlign.left, codeTable: 'CP1252')),
|
styles: const PosStyles(align: PosAlign.left, codeTable: 'CP1252')),
|
||||||
// PosColumn(
|
PosColumn(
|
||||||
// width: 1,
|
width: 1,
|
||||||
// text: ':',
|
text: ':',
|
||||||
// styles: const PosStyles(align: PosAlign.left, codeTable: 'CP1252')),
|
styles: const PosStyles(align: PosAlign.left, codeTable: 'CP1252')),
|
||||||
// PosColumn(
|
PosColumn(
|
||||||
// width: 5,
|
width: 5,
|
||||||
// text: '17.0',
|
text: '17.0',
|
||||||
// styles: const PosStyles(align: PosAlign.right, codeTable: 'CP1252')),
|
styles: const PosStyles(align: PosAlign.right, codeTable: 'CP1252')),
|
||||||
// ]);
|
]);
|
||||||
// bytes += generator.row([
|
bytes += generator.row([
|
||||||
// PosColumn(
|
PosColumn(
|
||||||
// width: 6,
|
width: 6,
|
||||||
// text: 'Kasir',
|
text: 'Kasir',
|
||||||
// styles: const PosStyles(align: PosAlign.left, codeTable: 'CP1252')),
|
styles: const PosStyles(align: PosAlign.left, codeTable: 'CP1252')),
|
||||||
// PosColumn(
|
PosColumn(
|
||||||
// width: 6,
|
width: 6,
|
||||||
// text: 'Anisa',
|
text: 'Anisa',
|
||||||
// styles: const PosStyles(align: PosAlign.right, codeTable: 'CP1252')),
|
styles: const PosStyles(align: PosAlign.right, codeTable: 'CP1252')),
|
||||||
// ]);
|
]);
|
||||||
|
|
||||||
// bytes += generator.text('--------------------------------',
|
bytes += generator.text('--------------------------------',
|
||||||
// styles: const PosStyles(align: PosAlign.center));
|
styles: const PosStyles(align: PosAlign.center));
|
||||||
|
|
||||||
// bytes += generator.text(
|
bytes += generator.text(
|
||||||
// 'BARANG YANG SUDAH DI BELI TIDAK DAPAT DITUKAR / DIKEMBALIKAN',
|
'BARANG YANG SUDAH DI BELI TIDAK DAPAT DITUKAR / DIKEMBALIKAN',
|
||||||
// styles: const PosStyles(align: PosAlign.center));
|
styles: const PosStyles(align: PosAlign.center));
|
||||||
// bytes += generator.text('TERIMA KASIH',
|
bytes += generator.text('TERIMA KASIH',
|
||||||
// styles: const PosStyles(align: PosAlign.center));
|
styles: const PosStyles(align: PosAlign.center));
|
||||||
|
|
||||||
// if (isPage == false) {
|
Navigator.push(
|
||||||
// _showPrintDialog(bytes, generator);
|
context,
|
||||||
// } else {
|
MaterialPageRoute(
|
||||||
// Navigator.push(
|
builder: (context) => MaxPrint(
|
||||||
// context,
|
bytes: bytes,
|
||||||
// MaterialPageRoute(
|
generator: generator,
|
||||||
// builder: (context) => MaxPrintPage(
|
)));
|
||||||
// bytes: bytes,
|
}
|
||||||
// generator: generator,
|
|
||||||
// title: 'Test',
|
|
||||||
// description: 'Test',
|
|
||||||
// onSuccess: () {
|
|
||||||
// Navigator.pop(context);
|
|
||||||
// log('Printed');
|
|
||||||
// },
|
|
||||||
// appBar: null,
|
|
||||||
// )));
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// _showPrintDialog(List<int> bytes, Generator generator) {
|
// _showPrintDialog(List<int> bytes, Generator generator) {
|
||||||
// return showDialog(
|
// return showDialog(
|
||||||
|
@@ -105,22 +105,6 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.7.10"
|
version: "0.7.10"
|
||||||
dio:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: dio
|
|
||||||
sha256: "5598aa796bbf4699afd5c67c0f5f6e2ed542afc956884b9cd58c306966efc260"
|
|
||||||
url: "https://pub.dev"
|
|
||||||
source: hosted
|
|
||||||
version: "5.7.0"
|
|
||||||
dio_web_adapter:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: dio_web_adapter
|
|
||||||
sha256: "33259a9276d6cea88774a0000cfae0d861003497755969c92faa223108620dc8"
|
|
||||||
url: "https://pub.dev"
|
|
||||||
source: hosted
|
|
||||||
version: "2.0.0"
|
|
||||||
drago_blue_printer:
|
drago_blue_printer:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -145,14 +129,6 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.1.0"
|
version: "0.1.0"
|
||||||
easy_logger:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: easy_logger
|
|
||||||
sha256: c764a6e024846f33405a2342caf91c62e357c24b02c04dbc712ef232bf30ffb7
|
|
||||||
url: "https://pub.dev"
|
|
||||||
source: hosted
|
|
||||||
version: "0.0.2"
|
|
||||||
fake_async:
|
fake_async:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -279,14 +255,6 @@ packages:
|
|||||||
description: flutter
|
description: flutter
|
||||||
source: sdk
|
source: sdk
|
||||||
version: "0.0.0"
|
version: "0.0.0"
|
||||||
js:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: js
|
|
||||||
sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3
|
|
||||||
url: "https://pub.dev"
|
|
||||||
source: hosted
|
|
||||||
version: "0.6.7"
|
|
||||||
leak_tracker:
|
leak_tracker:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -319,14 +287,6 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "4.0.0"
|
version: "4.0.0"
|
||||||
logging:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: logging
|
|
||||||
sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340"
|
|
||||||
url: "https://pub.dev"
|
|
||||||
source: hosted
|
|
||||||
version: "1.2.0"
|
|
||||||
matcher:
|
matcher:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -542,14 +502,6 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.8"
|
version: "2.1.8"
|
||||||
pool:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: pool
|
|
||||||
sha256: "20fe868b6314b322ea036ba325e6fc0711a22948856475e2c2b6306e8ab39c2a"
|
|
||||||
url: "https://pub.dev"
|
|
||||||
source: hosted
|
|
||||||
version: "1.5.1"
|
|
||||||
printing:
|
printing:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -566,14 +518,6 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "5.0.2"
|
version: "5.0.2"
|
||||||
puppeteer:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: puppeteer
|
|
||||||
sha256: fc33b2a12731e0b9e16c40cd91ea2b6886bcc24037a435fceb59b786d4074f2b
|
|
||||||
url: "https://pub.dev"
|
|
||||||
source: hosted
|
|
||||||
version: "3.15.0"
|
|
||||||
qr:
|
qr:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -743,10 +687,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: vm_service
|
name: vm_service
|
||||||
sha256: f652077d0bdf60abe4c1f6377448e8655008eef28f128bc023f7b5e8dfeb48fc
|
sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "14.2.4"
|
version: "14.2.5"
|
||||||
web:
|
web:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -755,14 +699,6 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.1.0"
|
version: "1.1.0"
|
||||||
webcontent_converter:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: webcontent_converter
|
|
||||||
sha256: dab8a6abda92eb83e168d92a66f1b174f7e8c317351e6cc868440a1c1343d5f5
|
|
||||||
url: "https://pub.dev"
|
|
||||||
source: hosted
|
|
||||||
version: "0.0.9+2"
|
|
||||||
webdriver:
|
webdriver:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@@ -0,0 +1,22 @@
|
|||||||
|
export 'package:drago_pos_printer/models/network_printer.dart';
|
||||||
|
export 'package:drago_pos_printer/models/bluetooth_printer.dart';
|
||||||
|
export 'package:drago_pos_printer/models/usb_printer.dart';
|
||||||
|
|
||||||
|
export 'package:drago_pos_printer/services/bluetooth_printer_manager_web.dart'
|
||||||
|
if (dart.library.js) 'package:drago_pos_printer/services/bluetooth_printer_manager_web.dart'
|
||||||
|
if (dart.library.io) 'package:drago_pos_printer/services/bluetooth_printer_manager.dart';
|
||||||
|
|
||||||
|
export 'package:drago_pos_printer/services/network_printer_manager.dart';
|
||||||
|
|
||||||
|
export 'package:drago_pos_printer/services/usb_printer_manager_web.dart'
|
||||||
|
if (dart.library.js) 'package:drago_pos_printer/services/usb_printer_manager_web.dart'
|
||||||
|
if (dart.library.io) 'package:drago_pos_printer/services/usb_printer_manager.dart';
|
||||||
|
|
||||||
|
export 'package:drago_pos_printer/enums/bluetooth_printer_type.dart';
|
||||||
|
export 'package:drago_pos_printer/enums/connection_response.dart';
|
||||||
|
export 'package:drago_pos_printer/enums/connection_type.dart';
|
||||||
|
export 'package:drago_pos_printer/utils/esc_pos_utils.dart';
|
||||||
|
export 'package:drago_pos_printer/utils/tsc_utils.dart';
|
||||||
|
export 'package:max_print_plus/print/max_print.dart';
|
||||||
|
|
||||||
|
class DragoPrinterManager {}
|
||||||
|
@@ -1,11 +1,17 @@
|
|||||||
import 'dart:typed_data';
|
import 'dart:typed_data';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:drago_pos_printer/drago_pos_printer.dart';
|
import 'package:drago_pos_printer/drago_pos_printer.dart';
|
||||||
import 'package:webcontent_converter/demo.dart';
|
// import 'package:webcontent_converter/demo.dart';
|
||||||
import 'package:webcontent_converter/webcontent_converter.dart';
|
// import 'package:webcontent_converter/webcontent_converter.dart';
|
||||||
import '../service/service.dart';
|
import '../service/service.dart';
|
||||||
|
|
||||||
class BluetoothPrinterScreen extends StatefulWidget {
|
class BluetoothPrinterScreen extends StatefulWidget {
|
||||||
|
List<int> bytes;
|
||||||
|
EscGenerator generator;
|
||||||
|
|
||||||
|
BluetoothPrinterScreen(
|
||||||
|
{super.key, required this.bytes, required this.generator});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_BluetoothPrinterScreenState createState() => _BluetoothPrinterScreenState();
|
_BluetoothPrinterScreenState createState() => _BluetoothPrinterScreenState();
|
||||||
}
|
}
|
||||||
@@ -37,9 +43,7 @@ class _BluetoothPrinterScreenState extends State<BluetoothPrinterScreen> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
backgroundColor: Color(0xFFFAFAFA),
|
||||||
title: Text("Bluetooth Printer Screen"),
|
|
||||||
),
|
|
||||||
body: ListView(
|
body: ListView(
|
||||||
padding: EdgeInsets.all(20),
|
padding: EdgeInsets.all(20),
|
||||||
children: [
|
children: [
|
||||||
@@ -166,25 +170,27 @@ class _BluetoothPrinterScreenState extends State<BluetoothPrinterScreen> {
|
|||||||
data = await ESCPrinterService(null).getSamplePosBytes(
|
data = await ESCPrinterService(null).getSamplePosBytes(
|
||||||
paperSizeWidthMM: paperWidth,
|
paperSizeWidthMM: paperWidth,
|
||||||
maxPerLine: charPerLine,
|
maxPerLine: charPerLine,
|
||||||
profile: profile);
|
profile: profile,
|
||||||
|
bytesData: widget.bytes,
|
||||||
|
);
|
||||||
} else if (byteType == 2) {
|
} else if (byteType == 2) {
|
||||||
data = await ESCPrinterService(null).getPdfBytes(
|
data = await ESCPrinterService(null).getPdfBytes(
|
||||||
paperSizeWidthMM: paperWidth,
|
paperSizeWidthMM: paperWidth,
|
||||||
maxPerLine: charPerLine,
|
maxPerLine: charPerLine,
|
||||||
profile: profile);
|
profile: profile);
|
||||||
} else if (byteType == 3) {
|
} else if (byteType == 3) {
|
||||||
final content = Demo.getShortReceiptContent();
|
// final content = Demo.getShortReceiptContent();
|
||||||
|
|
||||||
Uint8List? htmlBytes = await WebcontentConverter.contentToImage(
|
// Uint8List? htmlBytes = await WebcontentConverter.contentToImage(
|
||||||
content: content,
|
// content: content,
|
||||||
executablePath: WebViewHelper.executablePath(),
|
// executablePath: WebViewHelper.executablePath(),
|
||||||
);
|
// );
|
||||||
|
|
||||||
var service = ESCPrinterService(htmlBytes);
|
// var service = ESCPrinterService(htmlBytes);
|
||||||
data = await service.getBytes(
|
// data = await service.getBytes(
|
||||||
paperSizeWidthMM: paperWidth,
|
// paperSizeWidthMM: paperWidth,
|
||||||
maxPerLine: charPerLine,
|
// maxPerLine: charPerLine,
|
||||||
profile: profile);
|
// profile: profile);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_manager != null) {
|
if (_manager != null) {
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
|
import 'package:drago_pos_printer/utils/esc_pos/generator.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:max_print_plus/print/bluetooth_printer_screen.dart';
|
import 'package:max_print_plus/print/bluetooth_printer_screen.dart';
|
||||||
import 'package:max_print_plus/print/network_printer_screen.dart';
|
import 'package:max_print_plus/print/network_printer_screen.dart';
|
||||||
@@ -7,37 +8,11 @@ import 'tab_bar.dart';
|
|||||||
|
|
||||||
enum HistoryTabData { reservation, dinein, waitinglist, pickup, delivery }
|
enum HistoryTabData { reservation, dinein, waitinglist, pickup, delivery }
|
||||||
|
|
||||||
class MaxPrintArgs {
|
|
||||||
final int _index = 0;
|
|
||||||
|
|
||||||
HistoryTabData initialTab;
|
|
||||||
|
|
||||||
MaxPrintArgs({required this.initialTab});
|
|
||||||
|
|
||||||
int get initialIndex => mapTabDataToIndex();
|
|
||||||
|
|
||||||
int mapTabDataToIndex() {
|
|
||||||
switch (initialTab) {
|
|
||||||
case HistoryTabData.reservation:
|
|
||||||
return 0;
|
|
||||||
case HistoryTabData.dinein:
|
|
||||||
return 1;
|
|
||||||
case HistoryTabData.waitinglist:
|
|
||||||
return 2;
|
|
||||||
case HistoryTabData.pickup:
|
|
||||||
return 3;
|
|
||||||
case HistoryTabData.delivery:
|
|
||||||
return 4;
|
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class MaxPrint extends StatefulWidget {
|
class MaxPrint extends StatefulWidget {
|
||||||
MaxPrint({
|
List<int> bytes;
|
||||||
Key? key,
|
EscGenerator generator;
|
||||||
}) : super(key: key);
|
MaxPrint({Key? key, required this.bytes, required this.generator})
|
||||||
|
: super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<MaxPrint> createState() => _MaxPrintState();
|
State<MaxPrint> createState() => _MaxPrintState();
|
||||||
@@ -71,7 +46,15 @@ class _MaxPrintState extends State<MaxPrint> with TickerProviderStateMixin {
|
|||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
backgroundColor: Color(0xFFFAFAFA),
|
backgroundColor: Color(0xFFFAFAFA),
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Text('Print'),
|
backgroundColor: Color(0xFFFAFAFA),
|
||||||
|
centerTitle: true,
|
||||||
|
title: const Text(
|
||||||
|
'Print',
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
// letterSpacing: 2.0,
|
||||||
|
fontSize: 16),
|
||||||
|
),
|
||||||
bottom: CustomTabBar(
|
bottom: CustomTabBar(
|
||||||
tabController: _tabController,
|
tabController: _tabController,
|
||||||
tabs: [
|
tabs: [
|
||||||
@@ -89,7 +72,8 @@ class _MaxPrintState extends State<MaxPrint> with TickerProviderStateMixin {
|
|||||||
child: TabBarView(
|
child: TabBarView(
|
||||||
controller: _tabController,
|
controller: _tabController,
|
||||||
children: [
|
children: [
|
||||||
BluetoothPrinterScreen(),
|
BluetoothPrinterScreen(
|
||||||
|
bytes: widget.bytes, generator: widget.generator),
|
||||||
NetWorkPrinterScreen(),
|
NetWorkPrinterScreen(),
|
||||||
USBPrinterScreen()
|
USBPrinterScreen()
|
||||||
],
|
],
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:drago_pos_printer/drago_pos_printer.dart';
|
import 'package:drago_pos_printer/drago_pos_printer.dart';
|
||||||
import 'package:webcontent_converter/demo.dart';
|
// import 'package:webcontent_converter/demo.dart';
|
||||||
import 'package:webcontent_converter/webcontent_converter.dart';
|
// import 'package:webcontent_converter/webcontent_converter.dart';
|
||||||
|
|
||||||
import '../service/service.dart';
|
import '../service/service.dart';
|
||||||
|
|
||||||
@@ -40,6 +40,7 @@ class _NetWorkPrinterScreenState extends State<NetWorkPrinterScreen> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
backgroundColor: Color(0xFFFAFAFA),
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Text("Network Printer Screen ${printProfiles.length}"),
|
title: Text("Network Printer Screen ${printProfiles.length}"),
|
||||||
actions: [
|
actions: [
|
||||||
@@ -177,7 +178,7 @@ class _NetWorkPrinterScreenState extends State<NetWorkPrinterScreen> {
|
|||||||
_startPrinter(int byteType, NetWorkPrinter printer) async {
|
_startPrinter(int byteType, NetWorkPrinter printer) async {
|
||||||
await _connect(printer);
|
await _connect(printer);
|
||||||
// if (_data.isEmpty) {
|
// if (_data.isEmpty) {
|
||||||
final content = Demo.getShortReceiptContent();
|
// final content = Demo.getShortReceiptContent();
|
||||||
|
|
||||||
var stopwatch = Stopwatch()..start();
|
var stopwatch = Stopwatch()..start();
|
||||||
List<int> data = [];
|
List<int> data = [];
|
||||||
@@ -195,11 +196,11 @@ class _NetWorkPrinterScreenState extends State<NetWorkPrinterScreen> {
|
|||||||
profile: profile,
|
profile: profile,
|
||||||
name: _name);
|
name: _name);
|
||||||
} else if (byteType == 3) {
|
} else if (byteType == 3) {
|
||||||
var service = ESCPrinterService(await WebcontentConverter.contentToImage(
|
// var service = ESCPrinterService(await WebcontentConverter.contentToImage(
|
||||||
content: content,
|
// content: content,
|
||||||
executablePath: WebViewHelper.executablePath(),
|
// executablePath: WebViewHelper.executablePath(),
|
||||||
));
|
// ));
|
||||||
data = await service.getBytes(name: _name);
|
// data = await service.getBytes(name: _name);
|
||||||
}
|
}
|
||||||
|
|
||||||
print("Start print data $_name");
|
print("Start print data $_name");
|
||||||
@@ -209,8 +210,8 @@ class _NetWorkPrinterScreenState extends State<NetWorkPrinterScreen> {
|
|||||||
if (_manager != null) {
|
if (_manager != null) {
|
||||||
print("isConnected ${_manager!.printer.connected}");
|
print("isConnected ${_manager!.printer.connected}");
|
||||||
await _manager!.writeBytes(_data, isDisconnect: true);
|
await _manager!.writeBytes(_data, isDisconnect: true);
|
||||||
WebcontentConverter.logger
|
// WebcontentConverter.logger
|
||||||
.info("completed executed in ${stopwatch.elapsed}");
|
// .info("completed executed in ${stopwatch.elapsed}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -5,10 +5,10 @@ import 'dart:typed_data';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:max_print_plus/service/service.dart';
|
import 'package:max_print_plus/service/service.dart';
|
||||||
import 'package:open_filex/open_filex.dart';
|
import 'package:open_filex/open_filex.dart';
|
||||||
import 'package:path_provider/path_provider.dart';
|
// import 'package:path_provider/path_provider.dart';
|
||||||
import 'package:drago_pos_printer/drago_pos_printer.dart';
|
import 'package:drago_pos_printer/drago_pos_printer.dart';
|
||||||
import 'package:webcontent_converter/demo.dart';
|
// import 'package:webcontent_converter/demo.dart';
|
||||||
import 'package:webcontent_converter/webcontent_converter.dart';
|
// import 'package:webcontent_converter/webcontent_converter.dart';
|
||||||
|
|
||||||
class USBPrinterScreen extends StatefulWidget {
|
class USBPrinterScreen extends StatefulWidget {
|
||||||
@override
|
@override
|
||||||
@@ -44,9 +44,7 @@ class _USBPrinterScreenState extends State<USBPrinterScreen> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
backgroundColor: Color(0xFFFAFAFA),
|
||||||
title: Text("USB Printer Screen"),
|
|
||||||
),
|
|
||||||
body: ListView(
|
body: ListView(
|
||||||
padding: EdgeInsets.all(20),
|
padding: EdgeInsets.all(20),
|
||||||
children: [
|
children: [
|
||||||
@@ -161,72 +159,71 @@ class _USBPrinterScreenState extends State<USBPrinterScreen> {
|
|||||||
var manager = USBPrinterManager(printer);
|
var manager = USBPrinterManager(printer);
|
||||||
_manager = manager;
|
_manager = manager;
|
||||||
|
|
||||||
final content = Demo.getShortReceiptContent();
|
// final content = Demo.getShortReceiptContent();
|
||||||
var bytes = byteType == 1
|
var bytes = byteType == 1
|
||||||
? await ESCPrinterService(null).getSamplePosBytes(
|
? await ESCPrinterService(null).getSamplePosBytes(
|
||||||
paperSizeWidthMM: paperWidth,
|
paperSizeWidthMM: paperWidth,
|
||||||
maxPerLine: charPerLine,
|
maxPerLine: charPerLine,
|
||||||
profile: profile)
|
profile: profile)
|
||||||
: byteType == 2
|
: ESCPrinterService(null).getPdfBytes(
|
||||||
? await ESCPrinterService(null).getPdfBytes(
|
|
||||||
paperSizeWidthMM: paperWidth,
|
paperSizeWidthMM: paperWidth,
|
||||||
maxPerLine: charPerLine,
|
maxPerLine: charPerLine,
|
||||||
profile: profile)
|
profile: profile);
|
||||||
: (await WebcontentConverter.contentToImage(
|
// : (await WebcontentConverter.contentToImage(
|
||||||
content: content,
|
// content: content,
|
||||||
executablePath: WebViewHelper.executablePath(),
|
// executablePath: WebViewHelper.executablePath(),
|
||||||
))
|
// ))
|
||||||
.toList();
|
// .toList();
|
||||||
List<int> data;
|
// List<int> data;
|
||||||
if (byteType == 3) {
|
// if (byteType == 3) {
|
||||||
var service = ESCPrinterService(Uint8List.fromList(bytes));
|
// var service = ESCPrinterService(Uint8List.fromList(bytes));
|
||||||
data = await service.getBytes(
|
// data = await service.getBytes(
|
||||||
paperSizeWidthMM: paperWidth,
|
// paperSizeWidthMM: paperWidth,
|
||||||
maxPerLine: charPerLine,
|
// maxPerLine: charPerLine,
|
||||||
);
|
// );
|
||||||
if (bytes.length > 0) {
|
// if (bytes.length > 0) {
|
||||||
var dir = await getTemporaryDirectory();
|
// var dir = await getTemporaryDirectory();
|
||||||
var path = dir.path + "\\receipt.jpg";
|
// var path = dir.path + "\\receipt.jpg";
|
||||||
File file = File(path);
|
// File file = File(path);
|
||||||
await file.writeAsBytes(bytes);
|
// await file.writeAsBytes(bytes);
|
||||||
}
|
// }
|
||||||
} else
|
// } else
|
||||||
data = bytes;
|
// data = bytes;
|
||||||
if (mounted) setState(() => _data = data);
|
// if (mounted) setState(() => _data = data);
|
||||||
|
|
||||||
_manager!.writeBytes(_data);
|
_manager!.writeBytes(_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
_tsplPrint(USBPrinter printer) async {
|
_tsplPrint(USBPrinter printer) async {
|
||||||
int width = 105;
|
// int width = 105;
|
||||||
int height = 22;
|
// int height = 22;
|
||||||
int labelWidth = 35;
|
// int labelWidth = 35;
|
||||||
|
|
||||||
var image = await ESCPrinterService(null)
|
// var image = await ESCPrinterService(null)
|
||||||
.generateLabel(width, height, labelWidth, 1.5, 3);
|
// .generateLabel(width, height, labelWidth, 1.5, 3);
|
||||||
|
|
||||||
if (image != null) {
|
// if (image != null) {
|
||||||
var dir = await getTemporaryDirectory();
|
// var dir = await getTemporaryDirectory();
|
||||||
var path = dir.path + "\\receipt.png";
|
// var path = dir.path + "\\receipt.png";
|
||||||
File file = File(path);
|
// File file = File(path);
|
||||||
await file.writeAsBytes(img.encodePng(image));
|
// await file.writeAsBytes(img.encodePng(image));
|
||||||
OpenFilex.open(path);
|
// OpenFilex.open(path);
|
||||||
// for (int i = 1; i <= 1; i++) {
|
// // for (int i = 1; i <= 1; i++) {
|
||||||
// var manager = USBPrinterManager(printer);
|
// // var manager = USBPrinterManager(printer);
|
||||||
// TsplGenerator generator = TsplGenerator();
|
// // TsplGenerator generator = TsplGenerator();
|
||||||
// generator.addSize(width: width, height: height);
|
// // generator.addSize(width: width, height: height);
|
||||||
// generator.addGap(3);
|
// // generator.addGap(3);
|
||||||
// generator.addSpeed(4);
|
// // generator.addSpeed(4);
|
||||||
// generator.addDensity(Density.density15);
|
// // generator.addDensity(Density.density15);
|
||||||
// generator.addDirection(Direction.backWord);
|
// // generator.addDirection(Direction.backWord);
|
||||||
// generator.addTear(Tear.on);
|
// // generator.addTear(Tear.on);
|
||||||
// generator.addCodePageUtf8();
|
// // generator.addCodePageUtf8();
|
||||||
// generator.addCls();
|
// // generator.addCls();
|
||||||
// generator.addImage(image, needGrayscale: true);
|
// // generator.addImage(image, needGrayscale: true);
|
||||||
// generator.addPrint(1);
|
// // generator.addPrint(1);
|
||||||
// _data = generator.byte;
|
// // _data = generator.byte;
|
||||||
// manager.writeBytes(_data);
|
// // manager.writeBytes(_data);
|
||||||
|
// // }
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -198,6 +198,7 @@ class ESCPrinterService {
|
|||||||
int maxPerLine = PaperSizeMaxPerLine.mm80,
|
int maxPerLine = PaperSizeMaxPerLine.mm80,
|
||||||
CapabilityProfile? profile,
|
CapabilityProfile? profile,
|
||||||
String name = "default",
|
String name = "default",
|
||||||
|
List<int>? bytesData,
|
||||||
}) async {
|
}) async {
|
||||||
List<int> bytes = [];
|
List<int> bytes = [];
|
||||||
_profile = profile ?? (await CapabilityProfile.load(name: name));
|
_profile = profile ?? (await CapabilityProfile.load(name: name));
|
||||||
@@ -207,6 +208,7 @@ class ESCPrinterService {
|
|||||||
EscGenerator ticket =
|
EscGenerator ticket =
|
||||||
EscGenerator(_paperSizeWidthMM!, _maxPerLine!, _profile!);
|
EscGenerator(_paperSizeWidthMM!, _maxPerLine!, _profile!);
|
||||||
bytes += ticket.reset();
|
bytes += ticket.reset();
|
||||||
|
bytes.addAll(bytesData!);
|
||||||
//Print image
|
//Print image
|
||||||
// final ByteData data = await rootBundle.load('assets/logo.png');
|
// final ByteData data = await rootBundle.load('assets/logo.png');
|
||||||
// final Uint8List imageBytes = data.buffer.asUint8List();
|
// final Uint8List imageBytes = data.buffer.asUint8List();
|
||||||
@@ -336,193 +338,8 @@ class ESCPrinterService {
|
|||||||
// ]);
|
// ]);
|
||||||
|
|
||||||
// bytes += ticket.feed(1);
|
// bytes += ticket.feed(1);
|
||||||
bytes += ticket.text('Thank you!',
|
// bytes += ticket.text('Thank you!',
|
||||||
styles: PosStyles(align: PosAlign.center, bold: true));
|
// styles: PosStyles(align: PosAlign.center, bold: true));
|
||||||
bytes += ticket.text('MM TOYS',
|
|
||||||
styles: const PosStyles(align: PosAlign.center, bold: true));
|
|
||||||
|
|
||||||
bytes += ticket.text('Cikijing, Talaga, Bantarujeg, Rancah',
|
|
||||||
styles: const PosStyles(align: PosAlign.center, bold: true));
|
|
||||||
|
|
||||||
bytes += ticket.row([
|
|
||||||
PosColumn(
|
|
||||||
width: 6,
|
|
||||||
text: 'PENJUALAN :',
|
|
||||||
styles: const PosStyles(align: PosAlign.left, codeTable: 'CP1252')),
|
|
||||||
PosColumn(
|
|
||||||
width: 6,
|
|
||||||
text: '2024-03-14',
|
|
||||||
styles: const PosStyles(align: PosAlign.right, codeTable: 'CP1252')),
|
|
||||||
]);
|
|
||||||
|
|
||||||
bytes += ticket.row([
|
|
||||||
PosColumn(
|
|
||||||
width: 8,
|
|
||||||
text: 'PELANGGAN : UMUM-RCH',
|
|
||||||
styles: const PosStyles(align: PosAlign.left, codeTable: 'CP1252')),
|
|
||||||
PosColumn(
|
|
||||||
width: 4,
|
|
||||||
text: '15:30',
|
|
||||||
styles: const PosStyles(align: PosAlign.right, codeTable: 'CP1252')),
|
|
||||||
]);
|
|
||||||
|
|
||||||
bytes += ticket.text('--------------------------------',
|
|
||||||
styles: const PosStyles(align: PosAlign.center));
|
|
||||||
bytes += ticket.row([
|
|
||||||
PosColumn(
|
|
||||||
width: 6,
|
|
||||||
text: 'Qty',
|
|
||||||
styles: const PosStyles(align: PosAlign.left, codeTable: 'CP1252')),
|
|
||||||
PosColumn(
|
|
||||||
width: 6,
|
|
||||||
text: 'Nama Produk',
|
|
||||||
styles: const PosStyles(align: PosAlign.left, codeTable: 'CP1252')),
|
|
||||||
]);
|
|
||||||
|
|
||||||
bytes += ticket.row([
|
|
||||||
PosColumn(
|
|
||||||
width: 3,
|
|
||||||
text: 'Harga',
|
|
||||||
styles: const PosStyles(align: PosAlign.right, codeTable: 'CP1252')),
|
|
||||||
PosColumn(
|
|
||||||
width: 3,
|
|
||||||
text: 'Dis.',
|
|
||||||
styles: const PosStyles(align: PosAlign.right, codeTable: 'CP1252')),
|
|
||||||
PosColumn(
|
|
||||||
width: 3,
|
|
||||||
text: 'PPn',
|
|
||||||
styles: const PosStyles(align: PosAlign.right, codeTable: 'CP1252')),
|
|
||||||
PosColumn(
|
|
||||||
width: 3,
|
|
||||||
text: 'Netto',
|
|
||||||
styles: const PosStyles(align: PosAlign.right, codeTable: 'CP1252')),
|
|
||||||
]);
|
|
||||||
|
|
||||||
bytes += ticket.text('--------------------------------',
|
|
||||||
styles: const PosStyles(align: PosAlign.center));
|
|
||||||
|
|
||||||
// Dummy transaction data
|
|
||||||
List<String> dummyProducts = [
|
|
||||||
'Product 1',
|
|
||||||
'Product 2',
|
|
||||||
'Product 3',
|
|
||||||
];
|
|
||||||
|
|
||||||
for (var productName in dummyProducts) {
|
|
||||||
bytes += ticket.row([
|
|
||||||
PosColumn(
|
|
||||||
width: 12,
|
|
||||||
text: '2 ${productName.toUpperCase()}',
|
|
||||||
styles: const PosStyles(
|
|
||||||
align: PosAlign.left,
|
|
||||||
codeTable: 'CP1252',
|
|
||||||
)),
|
|
||||||
]);
|
|
||||||
|
|
||||||
bytes += ticket.row([
|
|
||||||
PosColumn(
|
|
||||||
width: 3,
|
|
||||||
text: '10.0',
|
|
||||||
styles: const PosStyles(align: PosAlign.left, codeTable: 'CP1252')),
|
|
||||||
PosColumn(
|
|
||||||
width: 3,
|
|
||||||
text: '0.0',
|
|
||||||
styles:
|
|
||||||
const PosStyles(align: PosAlign.right, codeTable: 'CP1252')),
|
|
||||||
PosColumn(
|
|
||||||
width: 3,
|
|
||||||
text: '',
|
|
||||||
styles:
|
|
||||||
const PosStyles(align: PosAlign.right, codeTable: 'CP1252')),
|
|
||||||
PosColumn(
|
|
||||||
width: 3,
|
|
||||||
text: '20.0',
|
|
||||||
styles:
|
|
||||||
const PosStyles(align: PosAlign.right, codeTable: 'CP1252')),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
bytes += ticket.text('--------------------------------',
|
|
||||||
styles: const PosStyles(align: PosAlign.center));
|
|
||||||
|
|
||||||
// Dummy total and payment data
|
|
||||||
bytes += ticket.row([
|
|
||||||
PosColumn(
|
|
||||||
width: 4,
|
|
||||||
text: 'Jumlah : 3',
|
|
||||||
styles: const PosStyles(align: PosAlign.left, codeTable: 'CP1252')),
|
|
||||||
PosColumn(
|
|
||||||
width: 4,
|
|
||||||
text: 'Item : 6',
|
|
||||||
styles: const PosStyles(align: PosAlign.center, codeTable: 'CP1252')),
|
|
||||||
PosColumn(
|
|
||||||
width: 4,
|
|
||||||
text: '33.0',
|
|
||||||
styles: const PosStyles(align: PosAlign.right, codeTable: 'CP1252')),
|
|
||||||
]);
|
|
||||||
|
|
||||||
// Dummy grand total, payment, change, and cashier data
|
|
||||||
bytes += ticket.row([
|
|
||||||
PosColumn(
|
|
||||||
width: 6,
|
|
||||||
text: 'Grand Total',
|
|
||||||
styles: const PosStyles(align: PosAlign.left, codeTable: 'CP1252')),
|
|
||||||
PosColumn(
|
|
||||||
width: 1,
|
|
||||||
text: ':',
|
|
||||||
styles: const PosStyles(align: PosAlign.left, codeTable: 'CP1252')),
|
|
||||||
PosColumn(
|
|
||||||
width: 5,
|
|
||||||
text: '33.0',
|
|
||||||
styles: const PosStyles(align: PosAlign.right, codeTable: 'CP1252')),
|
|
||||||
]);
|
|
||||||
bytes += ticket.row([
|
|
||||||
PosColumn(
|
|
||||||
width: 6,
|
|
||||||
text: 'Pembayaran',
|
|
||||||
styles: const PosStyles(align: PosAlign.left, codeTable: 'CP1252')),
|
|
||||||
PosColumn(
|
|
||||||
width: 1,
|
|
||||||
text: ':',
|
|
||||||
styles: const PosStyles(align: PosAlign.left, codeTable: 'CP1252')),
|
|
||||||
PosColumn(
|
|
||||||
width: 5,
|
|
||||||
text: '50.0',
|
|
||||||
styles: const PosStyles(align: PosAlign.right, codeTable: 'CP1252')),
|
|
||||||
]);
|
|
||||||
bytes += ticket.row([
|
|
||||||
PosColumn(
|
|
||||||
width: 6,
|
|
||||||
text: 'Kembalian',
|
|
||||||
styles: const PosStyles(align: PosAlign.left, codeTable: 'CP1252')),
|
|
||||||
PosColumn(
|
|
||||||
width: 1,
|
|
||||||
text: ':',
|
|
||||||
styles: const PosStyles(align: PosAlign.left, codeTable: 'CP1252')),
|
|
||||||
PosColumn(
|
|
||||||
width: 5,
|
|
||||||
text: '17.0',
|
|
||||||
styles: const PosStyles(align: PosAlign.right, codeTable: 'CP1252')),
|
|
||||||
]);
|
|
||||||
bytes += ticket.row([
|
|
||||||
PosColumn(
|
|
||||||
width: 6,
|
|
||||||
text: 'Kasir',
|
|
||||||
styles: const PosStyles(align: PosAlign.left, codeTable: 'CP1252')),
|
|
||||||
PosColumn(
|
|
||||||
width: 6,
|
|
||||||
text: 'Anisa',
|
|
||||||
styles: const PosStyles(align: PosAlign.right, codeTable: 'CP1252')),
|
|
||||||
]);
|
|
||||||
|
|
||||||
bytes += ticket.text('--------------------------------',
|
|
||||||
styles: const PosStyles(align: PosAlign.center));
|
|
||||||
|
|
||||||
bytes += ticket.text(
|
|
||||||
'BARANG YANG SUDAH DI BELI TIDAK DAPAT DITUKAR / DIKEMBALIKAN',
|
|
||||||
styles: const PosStyles(align: PosAlign.center));
|
|
||||||
bytes += ticket.text('TERIMA KASIH',
|
|
||||||
styles: const PosStyles(align: PosAlign.center));
|
|
||||||
|
|
||||||
// final now = DateTime.now();
|
// final now = DateTime.now();
|
||||||
// final formatter = DateFormat('MM/dd/yyyy H:m');
|
// final formatter = DateFormat('MM/dd/yyyy H:m');
|
||||||
|
@@ -11,12 +11,13 @@ dependencies:
|
|||||||
drago_pos_printer: ^1.0.1
|
drago_pos_printer: ^1.0.1
|
||||||
flutter:
|
flutter:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
flutter_svg: ^2.0.10+1
|
flutter_svg: ^2.0.5
|
||||||
fluttertoast: ^8.2.8
|
fluttertoast: ^8.2.8
|
||||||
open_filex: ^4.5.0
|
open_filex: ^4.5.0
|
||||||
|
path_provider: ^2.1.4
|
||||||
plugin_platform_interface: ^2.0.2
|
plugin_platform_interface: ^2.0.2
|
||||||
shared_preferences: ^2.3.2
|
shared_preferences: ^2.3.2
|
||||||
webcontent_converter: ^0.0.9+2
|
# webcontent_converter: ^0.0.9+2
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
Reference in New Issue
Block a user