Skip to content

Commit

Permalink
Added row() function.
Browse files Browse the repository at this point in the history
  • Loading branch information
andrey committed Jun 26, 2020
1 parent d4a4a5f commit 444cc7e
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions lib/src/sunmi_col.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* flutter_sunmi_printer
* Created by Andrey U.
*
* Copyright (c) 2020. All rights reserved.
* See LICENSE for distribution and usage details.
*/

import 'enums.dart';

/// Column contains text, align and width (an integer in 1..12 range)
class SunmiCol {
SunmiCol({
this.text = '',
this.width = 2,
this.align = SunmiAlign.left,
}) {
if (width < 1 || width > 12) {
throw Exception('Column width must be between 1..12');
}
}

String text;
int width;
SunmiAlign align;

Map<String, String> toJson() {
return {
"text": text,
"width": width.toString(),
"align": align.value.toString(),
};
}
}

0 comments on commit 444cc7e

Please sign in to comment.