thermal_printer_billbay 1.0.6
thermal_printer_billbay: ^1.0.6 copied to clipboard
A comprehensive Flutter plugin for ESC/POS thermal printers via Bluetooth Classic (SPP). Supports Arabic shaping, multiple code pages, receipt templates, images, QR codes, barcodes, and all standard E [...]
1.0.6 #
Fixed: Mixed Arabic/English Text Alignment in Multi-Column Rows #
The Problem (Before v1.0.6):
When using row() with mixed English/Arabic text in a single column, the text would split incorrectly:
// Your code:
cmd.row([
PosColumn(
text: 'Sub Total /المجموع الفرعي',
useLatin: false,
width: 9,
align: PrintAlign.left
),
PosColumn(
text: '520.00',
width: 3,
align: PrintAlign.right
),
], useLatin: true);
// ❌ PRINTED OUTPUT (WRONG):
// Sub Total /520.00 المجموع الفرعي
// ↑ ↑
// Left side shows English + amount, Arabic text appears on far right
Why This Happened:
- BiDi (bidirectional text) processing was applied per-column, not per-row
- Arabic text "المجموع الفرعي" was reversed within its column
- When columns were concatenated, Arabic ended up on the far right
The Solution (After v1.0.6):
// Same code - no changes needed!
cmd.row([
PosColumn(
text: 'Sub Total /المجموع الفرعي',
useLatin: false,
width: 9,
align: PrintAlign.left
),
PosColumn(
text: '520.00',
width: 3,
align: PrintAlign.right
),
], useLatin: true);
// ✅ PRINTED OUTPUT (CORRECT):
// Sub Total /المجموع الفرعي 520.00
// ↑ ↑
// Left column keeps text together, right column shows amount properly aligned
How the Update Fixes This:
- Row-Level BiDi Processing: Instead of processing each column independently, the entire row is now assembled first, then BiDi reversal is applied to the complete row
- Column Layout Preserved: The fix maintains column boundaries while ensuring Arabic text renders correctly
- Automatic Fix: Works automatically for existing code - no code changes required!
Technical Changes:
- Added
ArabicShaper.processRowWithColumns()method for row-level BiDi processing - Modified
row()method to use row-level processing when columns contain mixed languages - BiDi reversal now happens after all columns are assembled, not per-column
Works Great For:
- Receipt summary lines: "Sub Total /المجموع الفرعي"
- Invoice labels: "Total /المجموع"
- Mixed language column headers
- Any multi-column layout with Arabic/English text
Usage Examples:
// ✅ Example 1: Summary lines (FIXED in v1.0.6)
cmd.row([
PosColumn(text: 'Sub Total /المجموع الفرعي', useLatin: false, width: 9),
PosColumn(text: '520.00', width: 3, align: PrintAlign.right),
]);
// ✅ Example 2: Multiple summary lines
cmd.row([
PosColumn(text: 'Discount /خصم', useLatin: false, width: 9),
PosColumn(text: '0.00', width: 3, align: PrintAlign.right),
]);
cmd.row([
PosColumn(text: 'VAT /ضريبة', useLatin: false, width: 9),
PosColumn(text: '26.00', width: 3, align: PrintAlign.right),
]);
cmd.row([
PosColumn(text: 'Total /الإجمالي', useLatin: false, width: 9),
PosColumn(text: '546.00', width: 3, align: PrintAlign.right),
]);
// ✅ Example 3: Headers still work as before
cmd.textStyled(
'TAX INVOICE / فاتورة ضريبية',
PosStyles(align: PrintAlign.center, bold: true),
useLatin: false
);
Known Limitation:
- If using per-column styles (bold, underline) WITH mixed language, alignment may not be perfect
- Workaround: Split mixed text into separate English and Arabic columns
Migration:
- ✅ No code changes required - existing code works automatically
- ✅ Backward compatible with all previous versions
- ✅ All existing functionality preserved
1.0.5 #
- Added
CodePage.presetsstatic list containing all 8 built-in code page presets - Added
CodePage.presetsInfo()method for formatted summary of available code pages - Added
CodePage.fromString()for parsing code pages from user input (supports numbers, names, partial matches) - Added
CodePage.customArabic()factory for custom Arabic code page positions - Enhanced code page documentation with detailed descriptions for each preset
1.0.4 #
- Bug fixes and improvements
1.0.3 #
- Added print job progress tracking via
sendBytesWithProgress()with real-time progress events - Added
queryPrinterStatus()for printer hardware status (paper, cover, errors) via DLE EOT - Added
PrintProgress,PrintJobStatus, andPrinterStatusclasses - Added per-column text styling (bold, underline, etc.) in
row()columns - Added mixed Arabic/English support in multi-column rows via
useLatinfield - Added automatic word-wrapping for columns that exceed their width
- Added connection timeout (6s per attempt) for unavailable devices
- Fixed
connectionStatestream not firing events reliably - Fixed "Looking up deactivated widget's ancestor" error on connection
1.0.2 #
- Version bump
1.0.1 #
- Added built-in runtime permission handling (
requestPermissions(),checkPermissions()) - Added Bluetooth state management (
isBluetoothEnabled(),enableBluetooth()) - Added
ensureReady()convenience method for one-call setup - Added
connectWithRetry()with configurable retry attempts and delay - Improved Android Bluetooth connection with 4 fallback strategies
- Added
ActivityAwaresupport for native permission dialogs on Android - Fixed iOS plugin to handle all new permission/Bluetooth method calls
- Fixed podspec version mismatch
1.0.0 #
- Initial release
- Bluetooth Classic (SPP) connection for Android
- ExternalAccessory (MFi) connection for iOS
- Full ESC/POS command set: text, styles, images, QR codes, barcodes
- Arabic text shaping with automatic joining forms and Lam-Alef ligatures
- Bidi text reversal for RTL printing
- Multiple code pages: Win-1256, CP864, CP720, UTF-8, PC437, Win-1252, PC850
- Custom code page support (any number 0-255)
- Paper sizes: 58mm, 72mm, 80mm, 110mm, and custom
- Multi-column row layouts for receipts
- Receipt and invoice templates
- Image printing with monochrome conversion (PNG, JPEG, BMP)
- QR code generation (native ESC/POS)
- 9 barcode types: UPC-A, UPC-E, EAN-13, EAN-8, Code 39, ITF, Codabar, Code 93, Code 128
- Horizontal lines with 6 styles
- Paper cut, cash drawer, beep commands
- Raw bytes pass-through for custom commands