Commit 6fb75107 authored by Andrey's avatar Andrey

Refactoring

parent b8e3d1bb
...@@ -60,7 +60,7 @@ class _MyHomePageState extends State<MyHomePage> { ...@@ -60,7 +60,7 @@ class _MyHomePageState extends State<MyHomePage> {
void _testPrint(PrinterBluetooth printer) async { void _testPrint(PrinterBluetooth printer) async {
printerManager.selectPrinter(printer); printerManager.selectPrinter(printer);
Ticket ticket = Ticket(PaperSize.mm58); final Ticket ticket = Ticket(PaperSize.mm58);
ticket.text( ticket.text(
'Regular: aA bB cC dD eE fF gG hH iI jJ kK lL mM nN oO pP qQ rR sS tT uU vV wW xX yY zZ'); 'Regular: aA bB cC dD eE fF gG hH iI jJ kK lL mM nN oO pP qQ rR sS tT uU vV wW xX yY zZ');
......
...@@ -18,11 +18,13 @@ import 'pos_column.dart'; ...@@ -18,11 +18,13 @@ import 'pos_column.dart';
import 'pos_styles.dart'; import 'pos_styles.dart';
class Ticket { class Ticket {
Ticket(this._paperSize); Ticket(this._paperSize) {
reset();
}
List<int> bytes = []; List<int> bytes = [];
PosCodeTable _codeTable; PosCodeTable _codeTable;
PaperSize _paperSize; final PaperSize _paperSize;
/// Set global code table which will be used instead of the default printer's code table /// Set global code table which will be used instead of the default printer's code table
void setGlobalCodeTable(PosCodeTable codeTable) { void setGlobalCodeTable(PosCodeTable codeTable) {
...@@ -35,7 +37,7 @@ class Ticket { ...@@ -35,7 +37,7 @@ class Ticket {
} }
double _colIndToPosition(int colInd) { double _colIndToPosition(int colInd) {
int width = PaperSize.width(_paperSize); final int width = PaperSize.width(_paperSize);
return colInd == 0 ? 0 : (width * colInd / 11 - 1); return colInd == 0 ? 0 : (width * colInd / 11 - 1);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment