first commit

This commit is contained in:
2026-02-07 15:57:09 +07:00
commit 157096f164
1153 changed files with 415766 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
import 'dart:typed_data';
import 'package:bluetooth_print_plus/bluetooth_print_plus.dart';
Future<void> printLabelTest({
required String productName,
required String price,
required String date,
required String barcodeData,
required Uint8List pngBytes,
required bool isTwoInch,
}) async {
TscCommand tscCommand = TscCommand();
await tscCommand.cleanCommand();
await tscCommand.size(width: isTwoInch ? 45 : 38, height: 25); // mm
await tscCommand.gap(2);
await tscCommand.cls();
await tscCommand.image(image: pngBytes, x: 0, y: 0);
await tscCommand.print(1);
final cmd = await tscCommand.getCommand();
BluetoothPrintPlus.write(cmd);
}
String centerText(String text, {int lineWidth = 24}) {
if (text.length >= lineWidth) return text;
int totalPadding = lineWidth - text.length;
int leftPadding = totalPadding ~/ 2; // only add left padding
return ' ' * leftPadding + text;
}