Commit 315e90c1 authored by Andrey's avatar Andrey

init styles object.

parent de76a7e4
...@@ -8,9 +8,7 @@ ...@@ -8,9 +8,7 @@
import 'dart:io'; import 'dart:io';
import 'dart:typed_data'; import 'dart:typed_data';
// import 'package:esc_pos_printer/esc_pos_printer.dart';
import 'package:hex/hex.dart'; import 'package:hex/hex.dart';
import 'commands.dart'; import 'commands.dart';
import 'enums.dart'; import 'enums.dart';
import 'exceptions.dart'; import 'exceptions.dart';
...@@ -49,7 +47,7 @@ class Printer { ...@@ -49,7 +47,7 @@ class Printer {
/// [colInd] range: 0..11 /// [colInd] range: 0..11
void _print( void _print(
String text, { String text, {
PosStyles styles, PosStyles styles = const PosStyles(),
int colInd = 0, int colInd = 0,
int linesAfter = 0, int linesAfter = 0,
}) { }) {
...@@ -83,7 +81,11 @@ class Printer { ...@@ -83,7 +81,11 @@ class Printer {
} }
/// Prints one line of styled text /// Prints one line of styled text
void println(String text, {PosStyles styles, int linesAfter = 0}) { void println(
String text, {
PosStyles styles = const PosStyles(),
int linesAfter = 0,
}) {
_print(text, styles: styles, linesAfter: linesAfter); _print(text, styles: styles, linesAfter: linesAfter);
_socket.writeln(); _socket.writeln();
emptyLines(linesAfter); emptyLines(linesAfter);
...@@ -103,7 +105,7 @@ class Printer { ...@@ -103,7 +105,7 @@ class Printer {
for (int i = 0; i < cols.length; ++i) { for (int i = 0; i < cols.length; ++i) {
final colInd = final colInd =
cols.sublist(0, i).fold(0, (int sum, col) => sum + col.width); cols.sublist(0, i).fold(0, (int sum, col) => sum + col.width);
_print(cols[i].text, colInd: colInd); _print(cols[i].text, styles: cols[i].styles, colInd: colInd);
} }
_socket.writeln(); _socket.writeln();
......
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