update latest
This commit is contained in:
@@ -1,11 +1,17 @@
|
||||
import 'dart:typed_data';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:drago_pos_printer/drago_pos_printer.dart';
|
||||
import 'package:webcontent_converter/demo.dart';
|
||||
import 'package:webcontent_converter/webcontent_converter.dart';
|
||||
// import 'package:webcontent_converter/demo.dart';
|
||||
// import 'package:webcontent_converter/webcontent_converter.dart';
|
||||
import '../service/service.dart';
|
||||
|
||||
class BluetoothPrinterScreen extends StatefulWidget {
|
||||
List<int> bytes;
|
||||
EscGenerator generator;
|
||||
|
||||
BluetoothPrinterScreen(
|
||||
{super.key, required this.bytes, required this.generator});
|
||||
|
||||
@override
|
||||
_BluetoothPrinterScreenState createState() => _BluetoothPrinterScreenState();
|
||||
}
|
||||
@@ -37,9 +43,7 @@ class _BluetoothPrinterScreenState extends State<BluetoothPrinterScreen> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text("Bluetooth Printer Screen"),
|
||||
),
|
||||
backgroundColor: Color(0xFFFAFAFA),
|
||||
body: ListView(
|
||||
padding: EdgeInsets.all(20),
|
||||
children: [
|
||||
@@ -164,27 +168,29 @@ class _BluetoothPrinterScreenState extends State<BluetoothPrinterScreen> {
|
||||
late List<int> data;
|
||||
if (byteType == 1) {
|
||||
data = await ESCPrinterService(null).getSamplePosBytes(
|
||||
paperSizeWidthMM: paperWidth,
|
||||
maxPerLine: charPerLine,
|
||||
profile: profile);
|
||||
paperSizeWidthMM: paperWidth,
|
||||
maxPerLine: charPerLine,
|
||||
profile: profile,
|
||||
bytesData: widget.bytes,
|
||||
);
|
||||
} else if (byteType == 2) {
|
||||
data = await ESCPrinterService(null).getPdfBytes(
|
||||
paperSizeWidthMM: paperWidth,
|
||||
maxPerLine: charPerLine,
|
||||
profile: profile);
|
||||
} else if (byteType == 3) {
|
||||
final content = Demo.getShortReceiptContent();
|
||||
// final content = Demo.getShortReceiptContent();
|
||||
|
||||
Uint8List? htmlBytes = await WebcontentConverter.contentToImage(
|
||||
content: content,
|
||||
executablePath: WebViewHelper.executablePath(),
|
||||
);
|
||||
// Uint8List? htmlBytes = await WebcontentConverter.contentToImage(
|
||||
// content: content,
|
||||
// executablePath: WebViewHelper.executablePath(),
|
||||
// );
|
||||
|
||||
var service = ESCPrinterService(htmlBytes);
|
||||
data = await service.getBytes(
|
||||
paperSizeWidthMM: paperWidth,
|
||||
maxPerLine: charPerLine,
|
||||
profile: profile);
|
||||
// var service = ESCPrinterService(htmlBytes);
|
||||
// data = await service.getBytes(
|
||||
// paperSizeWidthMM: paperWidth,
|
||||
// maxPerLine: charPerLine,
|
||||
// profile: profile);
|
||||
}
|
||||
|
||||
if (_manager != null) {
|
||||
|
Reference in New Issue
Block a user