Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
E
esc_pos_print_plus
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dio Maulana
esc_pos_print_plus
Commits
8d35d61e
Commit
8d35d61e
authored
Jun 14, 2019
by
Andrey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PosColumn : assert replaced by Exception. PosRowException replaced by generic Exception.
parent
315e90c1
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
8 additions
and
21 deletions
+8
-21
README.md
README.md
+2
-1
esc_pos_printer.dart
lib/esc_pos_printer.dart
+0
-1
exceptions.dart
lib/src/exceptions.dart
+0
-16
pos_column.dart
lib/src/pos_column.dart
+5
-1
printer.dart
lib/src/printer.dart
+1
-2
No files found.
README.md
View file @
8d35d61e
...
@@ -83,3 +83,4 @@ printer.printRow([
...
@@ -83,3 +83,4 @@ printer.printRow([
*
Flutter example: print a demo receipt
*
Flutter example: print a demo receipt
*
Flutter example: discover active Wi-Fi printers
*
Flutter example: discover active Wi-Fi printers
*
USB, Bluetooth printers support
*
USB, Bluetooth printers support
*
Add encoding commands
\ No newline at end of file
lib/esc_pos_printer.dart
View file @
8d35d61e
...
@@ -7,6 +7,5 @@
...
@@ -7,6 +7,5 @@
library
esc_pos_printer
;
library
esc_pos_printer
;
export
'./src/enums.dart'
;
export
'./src/enums.dart'
;
export
'./src/exceptions.dart'
;
export
'./src/pos_styles.dart'
;
export
'./src/pos_styles.dart'
;
export
'./src/printer.dart'
;
export
'./src/printer.dart'
;
lib/src/exceptions.dart
deleted
100644 → 0
View file @
315e90c1
/*
* esc_pos_printer
* Created by Andrey Ushakov
*
* Copyright (c) 2019. All rights reserved.
* See LICENSE for distribution and usage details.
*/
/// Used by [Printer.printRow] method
class
PosRowException
implements
Exception
{
PosRowException
(
this
.
_msg
);
String
_msg
;
@override
String
toString
()
=>
'PosRowException:
$_msg
'
;
}
lib/src/pos_column.dart
View file @
8d35d61e
...
@@ -14,7 +14,11 @@ class PosColumn {
...
@@ -14,7 +14,11 @@ class PosColumn {
this
.
text
=
''
,
this
.
text
=
''
,
this
.
width
=
2
,
this
.
width
=
2
,
this
.
styles
=
const
PosStyles
(),
this
.
styles
=
const
PosStyles
(),
})
:
assert
(
width
>=
1
&&
width
<=
12
);
})
{
if
(
width
<
1
||
width
>
12
)
{
throw
Exception
(
'Column width must be between 1..12'
);
}
}
String
text
;
String
text
;
int
width
;
int
width
;
...
...
lib/src/printer.dart
View file @
8d35d61e
...
@@ -11,7 +11,6 @@ import 'dart:typed_data';
...
@@ -11,7 +11,6 @@ import 'dart:typed_data';
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
'pos_column.dart'
;
import
'pos_column.dart'
;
import
'pos_styles.dart'
;
import
'pos_styles.dart'
;
...
@@ -99,7 +98,7 @@ class Printer {
...
@@ -99,7 +98,7 @@ class Printer {
void
printRow
(
List
<
PosColumn
>
cols
)
{
void
printRow
(
List
<
PosColumn
>
cols
)
{
final
validSum
=
cols
.
fold
(
0
,
(
int
sum
,
col
)
=>
sum
+
col
.
width
)
==
12
;
final
validSum
=
cols
.
fold
(
0
,
(
int
sum
,
col
)
=>
sum
+
col
.
width
)
==
12
;
if
(!
validSum
)
{
if
(!
validSum
)
{
throw
PosRow
Exception
(
'Total columns width must be equal to 12'
);
throw
Exception
(
'Total columns width must be equal to 12'
);
}
}
for
(
int
i
=
0
;
i
<
cols
.
length
;
++
i
)
{
for
(
int
i
=
0
;
i
<
cols
.
length
;
++
i
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment